public class ProxyReader
extends Reader
This is similar to a FilterReader
but allows changing the proxied
Reader
with setProxied(java.util.Optional<java.io.Reader>)
which must be called at least once
with a non null argument before calling any other method except
getProxied()
and close()
to avoid a null pointer exception.
Constructor and Description |
---|
ProxyReader() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Optional<Reader> |
getProxied()
Gets the proxied reader.
|
void |
mark(int readAheadLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(char[] buffer) |
int |
read(char[] buffer,
int offset,
int length) |
int |
read(CharBuffer target) |
boolean |
ready() |
void |
reset() |
void |
setProxied(Optional<Reader> proxied)
Sets the proxied reader.
|
long |
skip(long n) |
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
@Nonnull @CheckReturnValue public Optional<Reader> getProxied()
public void mark(int readAheadLimit) throws IOException
mark
in class Reader
IOException
public boolean markSupported()
markSupported
in class Reader
public int read() throws IOException
read
in class Reader
IOException
public int read(char[] buffer) throws IOException
read
in class Reader
IOException
public int read(CharBuffer target) throws IOException
read
in interface Readable
read
in class Reader
IOException
public int read(char[] buffer, int offset, int length) throws IOException
read
in class Reader
IOException
public boolean ready() throws IOException
ready
in class Reader
IOException
public void reset() throws IOException
reset
in class Reader
IOException
public void setProxied(@Nonnull Optional<Reader> proxied)
proxied
- The proxied reader (empty to cancel).public long skip(long n) throws IOException
skip
in class Reader
IOException
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.