Package org.apache.pdfbox.io
Class RandomAccessReadWriteBuffer
- java.lang.Object
-
- org.apache.pdfbox.io.RandomAccessReadBuffer
-
- org.apache.pdfbox.io.RandomAccessReadWriteBuffer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.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.
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.io.RandomAccessReadBuffer
chunkSize, currentBuffer, currentBufferPointer, DEFAULT_CHUNK_SIZE_4KB, pointer, size
-
-
Constructor Summary
Constructors Constructor Description RandomAccessReadWriteBuffer()Default constructor.RandomAccessReadWriteBuffer(int definedChunkSize)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all data of the buffer.voidwrite(byte[] b)Write a buffer of data to the stream.voidwrite(byte[] b, int off, int len)Write a buffer of data to the stream.voidwrite(int b)Write a byte to the stream.-
Methods inherited from class org.apache.pdfbox.io.RandomAccessReadBuffer
checkClosed, close, createBufferFromStream, createView, expandBuffer, getPosition, isClosed, isEOF, length, read, read, resetBuffers, seek
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pdfbox.io.RandomAccessRead
available, createView, getPosition, isClosed, isEOF, length, peek, read, read, read, rewind, seek, skip
-
-
-
-
Method Detail
-
clear
public void clear() throws java.io.IOExceptionClears all data of the buffer.- Specified by:
clearin interfaceRandomAccessWrite- Throws:
java.io.IOException- If there is an error while clearing the data.
-
write
public void write(int b) throws java.io.IOExceptionWrite a byte to the stream.- Specified by:
writein interfaceRandomAccessWrite- Parameters:
b- The byte to write.- Throws:
java.io.IOException- If there is an IO error while writing.
-
write
public void write(byte[] b) throws java.io.IOExceptionWrite a buffer of data to the stream.- Specified by:
writein interfaceRandomAccessWrite- Parameters:
b- The buffer to get the data from.- Throws:
java.io.IOException- If there is an error while writing the data.
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrite a buffer of data to the stream.- Specified by:
writein interfaceRandomAccessWrite- 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:
java.io.IOException- If there is an error while writing the data.
-
-