Package i2p.susi.util

Class EOFOnMatchInputStream

All Implemented Interfaces:
ReadCounter, Closeable, AutoCloseable

public class EOFOnMatchInputStream extends PushbackInputStream implements ReadCounter
A stream that returns EOF when the input matches the bytes provided. The reader will never see any bytes from a full match. We extend PushbackInputStream for convenience, but we use its buffer as a fifo, not a stack. Do not call the unread() methods externally.
Since:
0.9.34
  • Constructor Details

    • EOFOnMatchInputStream

      public EOFOnMatchInputStream(InputStream in, byte[] match)
      Non-counter mode. getRead() will return 0.
      Parameters:
      match - will be copied
    • EOFOnMatchInputStream

      public EOFOnMatchInputStream(InputStream in, ReadCounter ctr, byte[] match)
      Counter mode. getRead() will the ReadCounter's value, not including the match bytes.
      Parameters:
      match - will be copied
  • Method Details