src/main/java/eu/digitisation/text/Text.java
private void readTextFile(File file) throws WarningException {
        // guess encoding if none is provided
        if (encoding == null) {
            encoding = Encoding.detect(file);
        }
        Messages.info("Text file " + file.getName() + " encoding is " + encoding);

        // read content
        try {
            FileInputStream fis = new FileInputStream(file);
            InputStreamReader isr = new InputStreamReader(fis, encoding);
            BufferedReader reader = new BufferedReader(isr);

            while (reader.ready()) {
                add(reader.readLine().trim());
            }
        } catch (IOException ex) {
            Messages.info(Text.class.getName() + ": " + ex);
        }
    }
/**
     * Read textual content and collapse whitespace: contiguous spaces are
     * considered a single one
     *
     * @param file the input text file
     */
Read textual content and collapse whitespace: contiguous spaces are
considered a single one

@param file the input text file
Read textual content and collapse whitespace : contiguous spaces are considered a single one @param file the input text file
private void readTextFile(File file) throws WarningException {
        if (encoding == null) {
            encoding = Encoding.detect(file);
        }
        Messages.info("Text file " + file.getName() + " encoding is " + encoding);
        try {
            FileInputStream fis = new FileInputStream(file);
            InputStreamReader isr = new InputStreamReader(fis, encoding);
            BufferedReader reader = new BufferedReader(isr);
            while (reader.ready()) {
                add(reader.readLine().trim());
            }
        } catch (IOException ex) {
            Messages.info(Text.class.getName() + ": " + ex);
        }
    }
private void readTextFile ( File file ) throws WarningException { if ( encoding == null ) { encoding = Encoding . detect ( file ) ; } Messages . info ( "Text file " + file . getName ( ) + " encoding is " + encoding ) ; try { FileInputStream fis = new FileInputStream ( file ) ; InputStreamReader isr = new InputStreamReader ( fis , encoding ) ; BufferedReader reader = new BufferedReader ( isr ) ; while ( reader . ready ( ) ) { add ( reader . readLine ( ) . trim ( ) ) ; } } catch ( IOException ex ) { Messages . info ( Text . class . getName ( ) + ": " + ex ) ; } }
Read textual content and collapse whitespace: contiguous spaces are
 considered a single one
Read textual content and collapse whitespace : contiguous spaces are considered a single one
// guess encoding if none is provided // read content