public final class PipeReader extends Reader
TextPipe
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this reader.
|
void |
close(IOException error)
Closes this reader.
|
TextPipe |
pipe()
Returns the pipe that this reader is reading from.
|
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
boolean |
ready() |
long |
skip(long n) |
public TextPipe pipe()
public int read() throws IOException
read
in class Reader
IOException
public int read(char[] cbuf, int off, int len) throws IOException
read
in class Reader
IOException
public long skip(long n) throws IOException
skip
in class Reader
IOException
public boolean ready() throws IOException
ready
in class Reader
IOException
public void close()
pipe
will be closed, and attempting to write to the pipe's writer will cause
an exception to be thrown. When reading from this reader, -1
is returned, except if an exception is set using
PipeWriter.close(IOException)
.
This method is like close(IOException)
, except it does not change the exception thrown from the pipe's writer'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 the exception to throw when
writing to the pipe's writer.
public void close(IOException error)
pipe
will be closed, and attempting to write to the pipe's writer will cause
an exception to be thrown. When reading from this reader, -1
is returned, except if an exception is set using
PipeWriter.close(IOException)
.
It is possible to call close()
and close(IOException)
several times. This can be used to change the exception to throw when
writing to the pipe's writer.
error
- If not null
, the exception to throw when writing to the pipe's writer.
Otherwise an exception is thrown that indicates the writer is closed.Copyright © 2020–2024. All rights reserved.