Class LookaheadInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class LookaheadInputStream
    extends FilterInputStream
    A wrapper for an InputStream that allows peek()ing one byte ahead in the stream. This is useful for detecting the end of a stream without actually consuming any data in the process (e.g. so the stream can be passed to another library that doesn't handle end-of-stream as the first byte well).