public final class PipeOutputStream extends OutputStream
BinaryPipe
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this output stream.
|
void |
close(IOException error)
Closes this output stream.
|
void |
flush() |
BinaryPipe |
pipe()
Returns the pipe that this output stream is writing to.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
public BinaryPipe pipe()
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close()
pipe
will be closed, and attempting to write to this output stream
will cause an exception to be thrown. The pipe's input stream will continue to consume the data that has been written; if all is consumed it
will return -1
from its read methods, unless if close(IOException)
is called with a non-null
error.
This method is like close(IOException)
, except it does not change the exception thrown from the pipe's input stream's methods.
This allows the use of close(IOException)
inside try-with-resources blocks without the automatic closing resetting the error.
It is possible to call close()
and close(IOException)
several times. This can be used to change or clear the exception to
throw when reading from the pipe's input stream.
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public void close(IOException error)
pipe
will be closed, and attempting to write to this output stream
will cause an exception to be thrown. If an exception is given, attempting to read from the pipe's input stream will cause this exception to be
thrown. Otherwise, the pipe's input stream will continue to consume the data that has been written; if all is consumed it will return
-1
from its read methods.
It is possible to call close()
and close(IOException)
several times. This can be used to change or clear the exception to
throw when reading from the pipe's input stream.
error
- If not null
, the exception to throw when reading from the pipe's input stream.
Otherwise, the input stream will continue to consume the data that has been written.Copyright © 2020–2024. All rights reserved.