org.pdfbox.io

Interface RandomAccess

Known Implementing Classes:
RandomAccessBuffer, RandomAccessFile

public interface RandomAccess

An interface to allow PDF files to be stored completely in memory or to use a scratch file on the disk.
Version:
$Revision: 1.2 $
Author:
Ben Litchfield

Method Summary

void
close()
Release resources that are being held.
long
length()
The total number of bytes that are available.
int
read()
Read a single byte of data.
int
read(byte[] b, int offset, int length)
Read a buffer of data.
void
seek(long position)
Seek to a position in the data.
void
write(byte[] b, int offset, int length)
Write a buffer of data to the stream.
void
write(int b)
Write a byte to the stream.

Method Details

close

public void close()
            throws IOException
Release resources that are being held.

length

public long length()
            throws IOException
The total number of bytes that are available.
Returns:
The number of bytes available.

read

public int read()
            throws IOException
Read a single byte of data.
Returns:
The byte of data that is being read.

read

public int read(byte[] b,
                int offset,
                int length)
            throws IOException
Read a buffer of data.
Parameters:
b - The buffer to write the data to.
offset - Offset into the buffer to start writing.
length - The amount of data to attempt to read.
Returns:
The number of bytes that were actually read.

seek

public void seek(long position)
            throws IOException
Seek to a position in the data.
Parameters:
position - The position to seek to.

write

public void write(byte[] b,
                  int offset,
                  int length)
            throws IOException
Write a buffer of data to the stream.
Parameters:
b - The buffer to get the data from.
offset - An offset into the buffer to get the data from.
length - The length of data to write.

write

public void write(int b)
            throws IOException
Write a byte to the stream.
Parameters:
b - The byte to write.