Interface ByteWriterFactory

All Known Implementing Classes:
SimpleByteWriterFactory

public interface ByteWriterFactory
Defines a factory for the construction of ByteWriter instances based on requested parameters.
  • Method Details

    • getByteWriter

      ByteWriter getByteWriter(ByteWriterFactory.Longevity longevity, ByteWriterFactory.EncryptionStatus encryption, ByteWriterFactory.Fixed fixed, long size, boolean fast) throws IOException
      Request a single ByteWriter with the given properties. An implementation is free to ignore the properties or to use them in any way that it views appropriate in choosing the right kind of ByteWriter to return. These should be viewed as "advice" to the implementation about the intended usage.
      Parameters:
      longevity - anticipated lifetime of the ByteWriter
      encryption - encryption status of the data to be placed into the ByteWriter
      fixed - whether the size given is the maximum data that will ever be placed into the ByteWriter
      size - either the maximum size of the data or an estimate of the size depending on the value of the fixed parameter
      fast - the requested ByteWriter needs to be fast
      Returns:
      a ByteWriter matching your properties to some degree of "match"
      Throws:
      IOException
    • getByteWriter

      ByteWriter[] getByteWriter(ByteWriterFactory.Longevity longevity, ByteWriterFactory.EncryptionStatus encryption, ByteWriterFactory.Fixed fixed, long[] size, boolean fast) throws IOException
      Request an array ByteWriter instances with the given properties. An implementation is free to ignore the properties or to use them in any way that it views appropriate in choosing the right kind of ByteWriter to return. These should be viewed as "advice" to the implementation about the intended usage.
      Parameters:
      longevity - anticipated lifetime of the ByteWriter
      encryption - encryption status of the data to be placed into the ByteWriter
      fixed - whether the size given is the maximum data that will ever be placed into the ByteWriter
      size - either the maximum size of the data or an estimate of the size depending on the value of the fixed parameter
      fast - the requested ByteWriter needs to be fast
      Returns:
      a ByteWriter matching your properties to some degree of "match"
      Throws:
      IOException
    • closeByteWriter

      void closeByteWriter(ByteWriter byteWriter) throws IOException
      The caller has finished with the given ByteWriter and will no longer use it again. The implementation can close it.
      Parameters:
      byteWriter - a no longer needed ByteWriter
      Throws:
      IOException
    • closeFactory

      void closeFactory() throws IOException
      The ByteWriterFactory is no longer needed and it should close down and free all resources allocated. All ByteWriter instances created by this factory can and may be destroyed during this process.
      Throws:
      IOException