org.dellroad.stuff.io
Class NullModemInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.dellroad.stuff.io.NullModemInputStream
- All Implemented Interfaces:
- Closeable
public class NullModemInputStream
- extends FilterInputStream
Presents an InputStream interface given a NullModemInputStream.WriteCallback that can write to an
OutputStream. A separate thread is created to perform the actual writing.
- Since:
- 1.0.74
NullModemInputStream
public NullModemInputStream(NullModemInputStream.WriteCallback writer,
String name)
- Constructor.
- Parameters:
writer - OutputStream writer callbackname - name for this instance; used to create the name of the background thread
getPipedInputStream
protected PipedInputStream getPipedInputStream()
- Get the wrapped stream cast as a
PipedInputStream.
finalize
protected void finalize()
throws Throwable
- Ensure input stream is closed when this instance is no longer referenced.
This ensures the writer thread wakes up (and exits, avoiding a memory leak) when an instance of this class
is created but never read from.
- Overrides:
finalize in class Object
- Throws:
Throwable