Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess.io
Class PGNReader

java.lang.Object
  extended byjava.io.Reader
      extended byjava.io.BufferedReader
          extended byictk.boardgame.io.GameReader
              extended byictk.boardgame.chess.io.ChessReader
                  extended byictk.boardgame.chess.io.PGNReader

public class PGNReader
extends ChessReader

PGNReader reads PGN formated files


Field Summary
static long DEBUG
          mask for Log.debug()
 
Constructor Summary
PGNReader(java.io.Reader _ir)
           
 
Method Summary
 Game getGame()
          gets the last game read.
 Board readBoard()
          looks for a readable board notation (FEN) in the GameInfo header
 Game readGame()
          read the Game (History, Board, and GameInfo) from the input Buffer
 GameInfo readGameInfo()
          reads the game info header portion of the PGN file
 History readHistory()
          reads the history list which must be in SAN format.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final long DEBUG
mask for Log.debug()

Constructor Detail

PGNReader

public PGNReader(java.io.Reader _ir)
Method Detail

readGame

public Game readGame()
              throws InvalidGameFormatException,
                     IllegalMoveException,
                     AmbiguousMoveException,
                     java.io.IOException
Description copied from class: GameReader
read the Game (History, Board, and GameInfo) from the input Buffer

Specified by:
readGame in class GameReader
Throws:
InvalidGameFormatException
IllegalMoveException
AmbiguousMoveException
java.io.IOException

getGame

public Game getGame()
gets the last game read. This can be used if an exception was thrown during the reading, and you still want the game.

Specified by:
getGame in class ChessReader

readGameInfo

public GameInfo readGameInfo()
                      throws java.io.IOException
reads the game info header portion of the PGN file

Specified by:
readGameInfo in class GameReader
Throws:
java.io.IOException

readHistory

public History readHistory()
                    throws InvalidGameFormatException,
                           IllegalMoveException,
                           AmbiguousMoveException,
                           java.io.IOException
reads the history list which must be in SAN format.

Specified by:
readHistory in class GameReader
Throws:
InvalidGameFormatException
IllegalMoveException
AmbiguousMoveException
java.io.IOException

readBoard

public Board readBoard()
                throws java.io.IOException
looks for a readable board notation (FEN) in the GameInfo header

Specified by:
readBoard in class GameReader
Returns:
null if there is no particular position associated with this board.
Throws:
java.io.IOException

Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .