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) boolean
private 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:
write
in classOutputStream
- Throws:
IOException
-
checkPipelineInput
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
waitForBuffer
- Throws:
IOException
-
notifyBuffer
void notifyBuffer()
-