Class ReplayInputStream

java.lang.Object
java.io.InputStream
org.refcodes.io.ReplayInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class ReplayInputStream extends InputStream
The ReplayInputStream wraps an InputStream adding mark(int), markSupported() as well as reset() functionality, similar to the BufferedInputStream. In contrast to the BufferedInputStream only the bytes actually read (by an application) are buffered, preventing it to hang as the BufferedInputStream would do when it tries to load a buffer of predefined size from (e.g. a serial TTY/COM port) InputStream which blocks till the requested data is actually available, making the whole application to "hang" (even though just one byte was to be read). The ReplayInputStream always uses its own mark(int), markSupported() as well as reset() implementations even if the wrapped InputStream (such as the BufferedInputStream supports mark(int) and reset()!