edu.harvard.hul.ois.jhove.module.pdf
Class FileTokenizer

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.pdf.Tokenizer
      extended by edu.harvard.hul.ois.jhove.module.pdf.FileTokenizer

public class FileTokenizer
extends Tokenizer

Tokenizer subclass which gets data from a RandomAccessFile.

Author:
Gary McGath

Field Summary
 
Fields inherited from class edu.harvard.hul.ois.jhove.module.pdf.Tokenizer
_ch, _file, PDFDOCENCODING
 
Constructor Summary
FileTokenizer(java.io.RandomAccessFile file)
           
 
Method Summary
 void backupChar()
          Back up a byte so it will be read again.
 long getFilePos()
          Gets the current position in the file.
protected  void initStream(Stream token)
          Streams can occur only in files, not in streams, so some of the initialization of a stream object goes here.
 int readChar()
          Gets a character from the file, using a buffer.
 void seek(long offset)
          Set the Tokenizer to a new position in the file.
protected  void setStreamOffset(Stream token)
          Sets the offset of a Stream to the current file position.
 
Methods inherited from class edu.harvard.hul.ois.jhove.module.pdf.Tokenizer
addLanguageCode, getLanguageCodes, getNext, getNext, getOffset, getPDFACompliant, getWSString, readChar1, scanMode, seekReset, setEncrypted, setPDFACompliant
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTokenizer

public FileTokenizer(java.io.RandomAccessFile file)
Method Detail

getFilePos

public long getFilePos()
                throws java.io.IOException
Gets the current position in the file. This method is aware of buffering.

Throws:
java.io.IOException

readChar

public int readChar()
             throws java.io.IOException
Gets a character from the file, using a buffer.

Specified by:
readChar in class Tokenizer
Throws:
java.io.IOException

seek

public void seek(long offset)
          throws java.io.IOException
Set the Tokenizer to a new position in the file.

Specified by:
seek in class Tokenizer
Parameters:
offset - The offset in bytes from the start of the file.
Throws:
java.io.IOException

backupChar

public void backupChar()
Back up a byte so it will be read again.

Specified by:
backupChar in class Tokenizer

initStream

protected void initStream(Stream token)
                   throws java.io.IOException
Streams can occur only in files, not in streams, so some of the initialization of a stream object goes here.

Specified by:
initStream in class Tokenizer
Throws:
java.io.IOException

setStreamOffset

protected void setStreamOffset(Stream token)
                        throws java.io.IOException
Sets the offset of a Stream to the current file position. Only the file-based tokenizer can do this, which is why this overrides the Tokenizer method.

Specified by:
setStreamOffset in class Tokenizer
Throws:
java.io.IOException