public final class PipeWriter extends Writer
TextPipe
.Modifier and Type | Method and Description |
---|---|
PipeWriter |
append(char c) |
PipeWriter |
append(CharSequence csq) |
PipeWriter |
append(CharSequence csq,
int start,
int end) |
void |
close()
Closes this writer.
|
void |
close(IOException error)
Closes this writer.
|
void |
flush() |
TextPipe |
pipe()
Returns the pipe that this writer is writing to.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int b) |
void |
write(String str,
int off,
int len) |
public TextPipe pipe()
public void write(int b) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
IOException
public PipeWriter append(CharSequence csq) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public PipeWriter append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public PipeWriter append(char c) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void close()
pipe
will be closed, and attempting to write to this writer will cause an
exception to be thrown. The pipe's reader 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 reader'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 reader.
public void close(IOException error)
pipe
will be closed, and attempting to write to this writer will cause an
exception to be thrown. If an exception is given, attempting to read from the pipe's reader will cause this exception to be thrown.
Otherwise, the pipe's reader 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 reader.
error
- If not null
, the exception to throw when reading from the pipe's reader.
Otherwise, the reader will continue to consume the data that has been written.Copyright © 2020–2024. All rights reserved.