Class BufferCharReader


  • public class BufferCharReader
    extends Object
    Bridge from byte stream to character stream. it likes to InputStreamReader Also it supports method "peek" for one character
    • Method Detail

      • peek

        public char peek()
                  throws IOException
        Read one character from stream without extracting it.
        Returns:
        Read character or CHAR_END_OF_STREAM if end of stream was reached
        Throws:
        IOException
      • readChar

        public char readChar()
                      throws IOException
        Read one character with extracting it
        Returns:
        Read character or CHAR_END_OF_STREAM if end of stream was reached
        Throws:
        IOException
      • read

        public int read​(char[] buf)
                 throws IOException
        Reads characters into an array.
        Parameters:
        buf - Destination buffer
        Returns:
        The number of characters read, or -1 if the end of the stream has been reached
        Throws:
        IOException
        See Also:
        .read(char[] cbuf)
      • read

        public int read​(char[] buf,
                        int offset,
                        int length)
                 throws IOException
        Reads characters into a portion of an array.
        Parameters:
        buf - Destination buffer
        offset - Offset at which to start storing characters
        length - Maximum number of characters to read
        Returns:
        The number of characters read, or -1 if the end of the stream has been reached
        Throws:
        IOException
        See Also:
        .read(har[] cbuf, int offset, int length)
      • isEOF

        public boolean isEOF()
                      throws IOException
        Was reached or not end of stream
        Returns:
        true, if was reached
        Throws:
        IOException
      • skip

        public long skip​(long n)
                  throws IOException
        Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.
        Parameters:
        n - The number of characters to skip
        Returns:
        The number of characters actually skipped
        Throws:
        IOException