Class PeekAheadInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class PeekAheadInputStream
    extends RewindableInputStream
    A version of RewindableInputStream that provides methods for peeking ahead in the stream (equivalent to read() followed by an appropriate unread()
    • Constructor Detail

      • PeekAheadInputStream

        public PeekAheadInputStream​(InputStream in)
      • PeekAheadInputStream

        public PeekAheadInputStream​(InputStream in,
                                    int initialSize)
    • Method Detail

      • peek

        public int peek​(byte[] buf)
                 throws IOException
        Peek the next bytes in the stream. Returns the number of bytes peeked. Will return -1 if the end of the stream is reached
        Throws:
        IOException
      • peek

        public int peek​(byte[] buf,
                        int off,
                        int len)
                 throws IOException
        Peek the next bytes in the stream. Returns the number of bytes peeked. Will return -1 if the end of the stream is reached
        Throws:
        IOException