klaus.fs
Class PGNStreamReader

java.lang.Object
  extended by klaus.fs.PGNStreamReader

public class PGNStreamReader
extends Object

This class reads a PGN file without using a database key.

Since:
2009-03-?? alpha2
Author:
Stephan Hillebrand

Field Summary
private  RandomAccessFile file
           
private  long lastLinePosition
           
 
Constructor Summary
PGNStreamReader(File pgnFile)
          Create a new PGN file
 
Method Summary
 long getLastLinePosition()
           
 String getNextParty()
          Gets the next party.
 void goTo(long target)
          Go to a certain pointer in the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private RandomAccessFile file

lastLinePosition

private long lastLinePosition
Constructor Detail

PGNStreamReader

public PGNStreamReader(File pgnFile)
                throws FileNotFoundException
Create a new PGN file

Parameters:
pgnFile - the file to read
Throws:
FileNotFoundException - if the file does not exist
Method Detail

goTo

public void goTo(long target)
          throws IOException
Go to a certain pointer in the file

Parameters:
target -
Throws:
IOException

getNextParty

public String getNextParty()
                    throws IOException,
                           EOFException
Gets the next party. If you want a certain game, specify the game's starting position using goTo(long) first, and then call getNextParty().

Returns:
a String containing the party, including all meta data.
Throws:
IOException - if the file could not be read
EOFException - if no more parties are contained

getLastLinePosition

public long getLastLinePosition()
                         throws IOException
Throws:
IOException