com.crionics.jpdf
Class ArrayByteReader

java.lang.Object
  extended by com.crionics.jpdf.ArrayByteReader
All Implemented Interfaces:
ByteReader

public class ArrayByteReader
extends java.lang.Object
implements ByteReader

This class is used to parse the document from a memory byte array


Constructor Summary
ArrayByteReader(byte[] theBuffer)
          Creates a new ArrayByteReader object.
ArrayByteReader(java.io.InputStream is)
          Creates a new ArrayByteReader object from an inputstream.
 
Method Summary
 void append(java.util.ArrayList theBuffer)
          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[] theBuffer, 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayByteReader

public ArrayByteReader(byte[] theBuffer)
Creates a new ArrayByteReader object.

Parameters:
theBuffer - The buffer in memory containing the PDF document.

ArrayByteReader

public ArrayByteReader(java.io.InputStream is)
                throws java.io.IOException
Creates a new ArrayByteReader object from an inputstream. The stream is copied into an internal byte buffer.

Parameters:
is - The input stream.
Throws:
java.io.IOException - io problem
Method Detail

append

public void append(java.util.ArrayList theBuffer)
Description copied from interface: ByteReader
Appends the array at the end of the bytereader.

Specified by:
append in interface ByteReader
Parameters:
theBuffer - bytes to append.
See Also:
ByteReader.append(ArrayList)

close

public void close()
Description copied from interface: ByteReader
Closes the document.

Specified by:
close in interface ByteReader
See Also:
ByteReader.close()

getID

public java.lang.String getID()
Description copied from interface: ByteReader
Returns a human readable description of this byte reader (for instance a path for a file,...).

Specified by:
getID in interface ByteReader
Returns:
A human readable description.
See Also:
ByteReader.getID()

getInputStream

public java.io.InputStream getInputStream()
Description copied from interface: ByteReader
Returns an InputStream on the document.

Specified by:
getInputStream in interface ByteReader
Returns:
an InputStream on the document.
See Also:
ByteReader.getInputStream()

length

public int length()
Description copied from interface: ByteReader
Returns the size of the document in bytes.

Specified by:
length in interface ByteReader
Returns:
The size of the document in bytes.
See Also:
ByteReader.length()

open

public void open()
Description copied from interface: ByteReader
Opens the document.

Specified by:
open in interface ByteReader
See Also:
ByteReader.open()

readUnsignedByte

public int readUnsignedByte()
Description copied from interface: ByteReader
Returns an unsigned byte from the document.

Specified by:
readUnsignedByte in interface ByteReader
Returns:
an unsigned byte from the document
See Also:
ByteReader.readUnsignedByte()

readUnsignedBytes

public void readUnsignedBytes(byte[] theBuffer,
                              int len)
Description copied from interface: ByteReader
Reads unsigned bytes from document and stores them in a buffer.

Specified by:
readUnsignedBytes in interface ByteReader
Parameters:
theBuffer - The byte buffer where the data will be stored.
len - The number of bytes to read from the document.
See Also:
ByteReader.readUnsignedBytes(byte[], int)

seek

public void seek(int pos)
          throws java.io.IOException
Description copied from interface: ByteReader
Sets the cursor position of the specified offset.

Specified by:
seek in interface ByteReader
Parameters:
pos - offset in bytes.
Throws:
java.io.IOException - io problem.
See Also:
ByteReader.seek(int)


Copyright © 1999-2007 Crionics. All Rights Reserved.