Class RandomAccessReadWriteBuffer

java.lang.Object
org.apache.pdfbox.io.RandomAccessReadBuffer
org.apache.pdfbox.io.RandomAccessReadWriteBuffer
All Implemented Interfaces:
Closeable, AutoCloseable, RandomAccess, RandomAccessRead, RandomAccessWrite

public class RandomAccessReadWriteBuffer extends RandomAccessReadBuffer implements RandomAccess
An implementation of the RandomAccess interface to store data in memory. The data will be stored in chunks organized in an ArrayList. The data can be read after writing.
  • Constructor Details

    • RandomAccessReadWriteBuffer

      public RandomAccessReadWriteBuffer()
      Default constructor.
    • RandomAccessReadWriteBuffer

      public RandomAccessReadWriteBuffer(int definedChunkSize)
      Default constructor.
  • Method Details

    • clear

      public void clear() throws IOException
      Clears all data of the buffer.
      Specified by:
      clear in interface RandomAccessWrite
      Throws:
      IOException - If there is an error while clearing the data.
    • write

      public void write(int b) throws IOException
      Write a byte to the stream.
      Specified by:
      write in interface RandomAccessWrite
      Parameters:
      b - The byte to write.
      Throws:
      IOException - If there is an IO error while writing.
    • write

      public void write(byte[] b) throws IOException
      Write a buffer of data to the stream.
      Specified by:
      write in interface RandomAccessWrite
      Parameters:
      b - The buffer to get the data from.
      Throws:
      IOException - If there is an error while writing the data.
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Write a buffer of data to the stream.
      Specified by:
      write in interface RandomAccessWrite
      Parameters:
      b - The buffer to get the data from.
      off - An offset into the buffer to get the data from.
      len - The length of data to write.
      Throws:
      IOException - If there is an error while writing the data.