com.crionics.jpdf
Interface ByteReader

All Known Implementing Classes:
ArrayByteReader, FileByteReader, URLByteReader

public interface ByteReader

Interface used as a wrapper for random access streams.
Two implementations are available: File and Memory.
A network implementation would be really easy to do...


Method Summary
 void append(java.util.ArrayList buffer)
          Appends the array at the end of the bytereader.
 void close()
          Closes the document.
 java.lang.String getID()
          Returns a human readable description of this byte reader (for instance a path for a file,...).
 java.io.InputStream getInputStream()
          Returns an InputStream on the document.
 int length()
          Returns the size of the document in bytes.
 void open()
          Opens the document.
 int readUnsignedByte()
          Returns an unsigned byte from the document.
 void readUnsignedBytes(byte[] buffer, int len)
          Reads unsigned bytes from document and stores them in a buffer.
 void seek(int pos)
          Sets the cursor position of the specified offset.
 

Method Detail

append

void append(java.util.ArrayList buffer)
            throws java.io.IOException
Appends the array at the end of the bytereader.

Parameters:
buffer - bytes to append.
Throws:
java.io.IOException - if an IO problem happens.

close

void close()
           throws java.io.IOException
Closes the document.

Throws:
java.io.IOException - if an IO problem happens.

getID

java.lang.String getID()
Returns a human readable description of this byte reader (for instance a path for a file,...).

Returns:
A human readable description.

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream on the document.

Returns:
an InputStream on the document.
Throws:
java.io.IOException - if an IO problem happens.

length

int length()
Returns the size of the document in bytes.

Returns:
The size of the document in bytes.

open

void open()
          throws java.io.IOException
Opens the document.

Throws:
java.io.IOException - if an IO problem happens.

readUnsignedByte

int readUnsignedByte()
                     throws java.io.IOException
Returns an unsigned byte from the document.

Returns:
an unsigned byte from the document
Throws:
java.io.IOException - if an IO problem happens

readUnsignedBytes

void readUnsignedBytes(byte[] buffer,
                       int len)
                       throws java.io.IOException
Reads unsigned bytes from document and stores them in a buffer.

Parameters:
buffer - The byte buffer where the data will be stored.
len - The number of bytes to read from the document.
Throws:
java.io.IOException - if an IO problem happens

seek

void seek(int pos)
          throws java.io.IOException
Sets the cursor position of the specified offset.

Parameters:
pos - offset in bytes.
Throws:
java.io.IOException - io problem.


Copyright © 1999-2007 Crionics. All Rights Reserved.