Class IPushbackReader


  • public class IPushbackReader
    extends Object
    IPushBackReader based on Reader Not thread safe support unlimited unread operation
    Author:
    chenxin
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getQueueSize()
      get the buffer size - the number of buffered data
      int read()
      read the next int from the stream this will check the buffer queue first and take the first item of the buffer as the result
      int read​(char[] cbuf, int off, int len)
      read the specified block from the stream
      void unread​(char[] cbuf, int off, int len)
      unread a block from a char array to the stream
      void unread​(int data)
      unread the specified data to the stream push the data back to the queue in fact, you know
    • Constructor Detail

      • IPushbackReader

        public IPushbackReader​(Reader reader)
    • Method Detail

      • read

        public int read()
                 throws IOException
        read the next int from the stream this will check the buffer queue first and take the first item of the buffer as the result
        Returns:
        int
        Throws:
        IOException
      • read

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws IOException
        read the specified block from the stream
        Returns:
        int
        Throws:
        IOException
        See Also:
        read()
      • unread

        public void unread​(int data)
        unread the specified data to the stream push the data back to the queue in fact, you know
      • getQueueSize

        public int getQueueSize()
        get the buffer size - the number of buffered data
        Returns:
        int
      • unread

        public void unread​(char[] cbuf,
                           int off,
                           int len)
        unread a block from a char array to the stream
        See Also:
        unread(int)