Package org.greenrobot.essentials.io
Class PipelineOutputStream
java.lang.Object
java.io.OutputStream
org.greenrobot.essentials.io.PipelineOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Replacement for Java's PipedOutputStream: all data written to this stream will get available in the integrated
InputStream (see
getInputStream()).
Note: Usually, you will have exactly two threads: one to write and one to read. If you use a single thread, avoid
reading more bytes than previously written or writing more bytes than the internal buffer can handle.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final CircularByteBuffer(package private) boolean(package private) booleanprivate final PipelineOutputStream.PipelineInputStream -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Field Details
-
inputStream
-
buffer
-
closedOut
boolean closedOut -
closedIn
boolean closedIn
-
-
Constructor Details
-
PipelineOutputStream
public PipelineOutputStream() -
PipelineOutputStream
public PipelineOutputStream(int bufferCapacity)
-
-
Method Details
-
getInputStream
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
checkPipelineInput
- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
waitForBuffer
- Throws:
IOException
-
notifyBuffer
void notifyBuffer()
-