Class BackwardsLineReader


  • public class BackwardsLineReader
    extends Object
    Reads lines from "backwards" InputStream. This class facilitates reading files from bottom up.

    This source code was kindly contributed by Kan Ogawa.

    • Field Detail

      • skipLineFeed

        private boolean skipLineFeed
        The skip line feed.
      • encoding

        private String encoding
        The encoding.
    • Constructor Detail

      • BackwardsLineReader

        public BackwardsLineReader​(InputStream is)
        Instantiates a new backwards line reader.
        Parameters:
        is - the is
      • BackwardsLineReader

        public BackwardsLineReader​(InputStream is,
                                   String encoding)
        Instantiates a new backwards line reader.
        Parameters:
        is - the is
        encoding - the encoding
    • Method Detail

      • readLine

        public String readLine()
                        throws IOException
        Read line.
        Returns:
        the string
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • close

        public void close()
                   throws IOException
        Close.
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • reverse

        private void reverse​(byte[] byteArray)
        Reverse.
        Parameters:
        byteArray - the byte array