Class PGNImporter

java.lang.Object
io.github.wolfraam.chessgame.pgn.PGNImporter

public class PGNImporter extends Object
Imports games in PGN format.
  • Constructor Details

    • PGNImporter

      public PGNImporter()
  • Method Details

    • run

      public void run(InputStream inputStream)
      Imports the game from the InputStream.
    • run

      public void run(File file) throws FileNotFoundException
      Imports the game from the File.
      Throws:
      FileNotFoundException
    • setAcceptTagsPredicate

      public void setAcceptTagsPredicate(Predicate<Map<PGNTag,String>> acceptTagsPredicate)
      Sets a Predicate which determines whether the game should be imported, based on the supplied tags.
    • setFen2NewChessGameFunction

      public void setFen2NewChessGameFunction(Function<String,ChessGame> fen2NewChessGameFunction)
      Sets a Function which generates a ChessGame with the given FEN String. Use this when you want to use a subclass of ChessGame.
    • setOnError

      public void setOnError(BiConsumer<String,RuntimeException> onError)
      Sets a Consumer which will be called with import errors.
    • setOnGame

      public void setOnGame(Consumer<ChessGame> onGame)
      Sets a Consumer which will be called with the imported ChessGames.
    • setOnWarning

      public void setOnWarning(Consumer<String> onWarning)
      Sets a Consumer which will be called with import warnings.