Class LineSeparatorDetector


  • public class LineSeparatorDetector
    extends java.lang.Object
    Automatically detects the line separator type used on a text file. Supports Mac OS (old), Linux/Unix and Windows-style line breaks.
    Author:
    Rene Schneider - initial API and implementation
    • Constructor Detail

      • LineSeparatorDetector

        public LineSeparatorDetector()
        Creates a new instance with default settings.
      • LineSeparatorDetector

        public LineSeparatorDetector​(int aMaxScanSize)
        Creates a new instance.
        Parameters:
        aMaxScanSize - the maximum bytes to scan in a file before giving up
    • Method Detail

      • detectLineBreakType

        public LineSeparatorDetector.LineSeparatorType detectLineBreakType​(java.io.InputStream aStream)
                                                                    throws java.io.IOException
        Attempts to detect the line break type of the provided InputStream.
        Parameters:
        aStream - the stream to scan
        Returns:
        the detected line break type or null if no decision could be made
        Throws:
        java.io.IOException