Interface StringDetector

All Known Implementing Classes:
SimpleStringDetector

public interface StringDetector
Interface for checking if a text line in a file seems to be decoded correctly with the current character set. See the SimpleStringDetector for a simple implementation that can be used to detect the encoding in a datafile that contains a header line.
Since:
3.15
Author:
nicklas
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkLine(int lineNo, String line)
    Check the given line.
    void
    eof(int parsedLines)
    This is called when the end of file has been reached and the checkLine method has returned false for all lines.
  • Method Details

    • checkLine

      boolean checkLine(int lineNo, String line) throws IOException
      Check the given line. The detector should return TRUE if it can be certain that the file has been decoded correctly. If it can be sure that the file has been decoded incorrecty it should throw an IOException. If the detector is not sure without more data, it should return false.
      Throws:
      IOException
    • eof

      void eof(int parsedLines) throws IOException
      This is called when the end of file has been reached and the checkLine method has returned false for all lines. If this is considered to be an incorrect decoding condition, the detector should throw an IOException, otherwise it should simply return. Note that this method is not called if TRUE is returned from the checkLine method.
      Throws:
      IOException