Class LineInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class LineInputStream
    extends java.io.FilterInputStream
    This class is to support reading CRLF terminated lines that contain only US-ASCII characters from an input stream. Provides functionality that is similar to the deprecated DataInputStream.readLine(). Expected use is to read lines as String objects from a RFC822 stream. It is implemented as a FilterInputStream, so one can just wrap this class around any input stream and read bytes from this filter.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private char[] lineBuffer  
      private static int MAX_INCR  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      LineInputStream​(java.io.InputStream in)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String readLine()
      Read a line containing only ASCII characters from the input stream.
      • Methods inherited from class java.io.FilterInputStream

        available, close, mark, markSupported, read, read, read, reset, skip
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lineBuffer

        private char[] lineBuffer
      • MAX_INCR

        private static int MAX_INCR
    • Constructor Detail

      • LineInputStream

        public LineInputStream​(java.io.InputStream in)
    • Method Detail

      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        Read a line containing only ASCII characters from the input stream. A line is terminated by a CR or NL or CR-NL sequence. A common error is a CR-CR-NL sequence, which will also terminate a line. The line terminator is not returned as part of the returned String. Returns null if no data is available.

        This class is similar to the deprecated DataInputStream.readLine()

        Throws:
        java.io.IOException