com.crionics.jpdf
Class FileByteReader

java.lang.Object
  extended by com.crionics.jpdf.FileByteReader
All Implemented Interfaces:
ByteReader
Direct Known Subclasses:
URLByteReader

public class FileByteReader
extends java.lang.Object
implements ByteReader

This class is used to parse the document from a random access file


Constructor Summary
FileByteReader(java.io.File theFile)
          Creates a new FileByteReader object.
FileByteReader(java.io.File theFile, boolean checkExistance)
          Creates a new FileByteReader object.
 
Method Summary
 void append(java.util.ArrayList buffer)
          Appends the array at the end of the bytereader.
 void close()
          Closes the document.
 java.io.File getFile()
           
 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 LEN bytes of data to 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

FileByteReader

public FileByteReader(java.io.File theFile)
               throws java.io.IOException
Creates a new FileByteReader object.

Parameters:
theFile - the file to work on
Throws:
java.io.IOException - io issue

FileByteReader

public FileByteReader(java.io.File theFile,
                      boolean checkExistance)
               throws java.io.IOException
Creates a new FileByteReader object.

Parameters:
theFile - the file to read the pdf document from
checkExistance - true is file existance must be checked
Throws:
java.io.IOException - io problem
Method Detail

append

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

Specified by:
append in interface ByteReader
Parameters:
buffer - bytes to append.
Throws:
java.io.IOException - if an IO problem happens.
See Also:
ByteReader.append(ArrayList)

close

public void close()
           throws java.io.IOException
Description copied from interface: ByteReader
Closes the document.

Specified by:
close in interface ByteReader
Throws:
java.io.IOException - if an IO problem happens.
See Also:
ByteReader.close()

getFile

public java.io.File getFile()

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()
                                   throws java.io.IOException
Description copied from interface: ByteReader
Returns an InputStream on the document.

Specified by:
getInputStream in interface ByteReader
Returns:
an InputStream on the document.
Throws:
java.io.IOException - if an IO problem happens.
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()
          throws java.io.IOException
Description copied from interface: ByteReader
Opens the document.

Specified by:
open in interface ByteReader
Throws:
java.io.IOException - if an IO problem happens.
See Also:
ByteReader.open()

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException
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
Throws:
java.io.IOException - if an IO problem happens
See Also:
ByteReader.readUnsignedByte()

readUnsignedBytes

public void readUnsignedBytes(byte[] buffer,
                              int len)
                       throws java.io.IOException
reads LEN bytes of data to BUFFER

Specified by:
readUnsignedBytes in interface ByteReader
Parameters:
buffer - when to read the bytes to
len - number of bytes to read
Throws:
java.io.IOException - io issue

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.