Interface ByteWriter

All Superinterfaces:
ByteReader
All Known Implementing Classes:
ByteArrayByteWriter, ByteBufferByteWriter, FilterByteWriter, InputStreamByteWriter, LazyRandomAccessFileByteWriter, MemoryMappedByteWriter, NonCachedRandomAccessFileByteWriter, RandomAccessFileByteWriter, RangedByteWriter

public interface ByteWriter extends ByteReader

The ByteWriter provides an abstraction to a linear, zero-based, semi-infinite array of bytes that can be read from at any point. The actual repository can store these bytes in any manner that best fits the storage medium but the view on them provided by this interface must be as above.

  • Field Summary

    Fields inherited from interface com.adobe.internal.io.ByteReader

    EOF
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flushes this ByteWriter and forces any unwritten buffered output bytes to be written out to the underlying repository.
    void
    write(long position, byte[] b, int offset, int length)
    Write an array of bytes at the position given.
    void
    write(long position, int b)
    Write the byte given at the position given.

    Methods inherited from interface com.adobe.internal.io.ByteReader

    close, length, read, read
  • Method Details

    • write

      void write(long position, int b) throws IOException
      Write the byte given at the position given. If during the write operation the byte to be written is beyond the end of the virtual array visible through this interface then the length of that virtual array becomes the position of the byte written plus one (because of zero based counting). length of virtual array = max(length of virtual array, position of byte written + 1)
      Parameters:
      position - the zero-based offset within the byte array.
      b - the byte to write.
      Throws:
      IOException - if an error occurs during the write operation
    • write

      void write(long position, byte[] b, int offset, int length) throws IOException
      Write an array of bytes at the position given. If during the write operation any of the bytes are to be written beyond the end of the virtual array visible through this interface then the length of that virtual array becomes the position of the byte written plus one (because of zero based counting). for each byte written : length of virtual array = max(length of virtual array, position of byte written + 1)
      Parameters:
      position - the zero-based offset within the byte array.
      b - the array of bytes to write from.
      offset - the offset within the byte array to start writing from.
      length - the number of bytes to write from the byte array.
      Throws:
      IOException - if an error occurs during the write operation
    • flush

      void flush() throws IOException
      Flushes this ByteWriter and forces any unwritten buffered output bytes to be written out to the underlying repository.
      Throws:
      IOException - if an error occurs while trying to flush the buffer