question: public static boolean singleNewlineTerminated ( File inputFile ) throws IOException { RandomAccessFile randomAccessFile = new RandomAccessFile ( inputFile , READ_ONLY_MODE ) ; if ( inputFile . length ( ) < 1 ) { return true ; } randomAccessFile . seek ( inputFile . length ( ) - 1 ) ; if ( Byte . compare ( randomAccessFile . readByte ( ) , NEWLINE_DELIMITER ) != 0 ) { return false ; } if ( inputFile . length ( ) < 2 ) { return true ; } randomAccessFile . seek ( inputFile . length ( ) - 2 ) ; return ( Byte . compare ( randomAccessFile . readByte ( ) , NEWLINE_DELIMITER ) != 0 ) ; }
target:  Checks whether a file is terminated with exactly one trailing newline.