? ProxyReader
- ????????:
Closeable
,AutoCloseable
,Readable
- ??????:
CloseShieldReader
,TaggedReader
,TeeReader
It is an alternative base class to FilterReader to increase reusability, because FilterReader changes the methods being called, such as read(char[]) to read(char[], int, int).
-
????
??????? java.io.FilterReader
in
-
?????
??? -
????
??????????protected void
afterRead
(int n) Invoked by the read methods after the proxied call has returned successfully.protected void
beforeRead
(int n) Invoked by the read methods before the call is proxied.void
close()
Invokes the delegate'sclose()
method.protected void
Handle any IOExceptions thrown.void
mark
(int idx) Invokes the delegate'smark(int)
method.boolean
Invokes the delegate'smarkSupported()
method.int
read()
Invokes the delegate'sread()
method.int
read
(char[] chr) Invokes the delegate'sread(char[])
method.int
read
(char[] chr, int st, int len) Invokes the delegate'sread(char[], int, int)
method.int
read
(CharBuffer target) Invokes the delegate'sread(CharBuffer)
method.boolean
ready()
Invokes the delegate'sready()
method.void
reset()
Invokes the delegate'sreset()
method.long
skip
(long ln) Invokes the delegate'sskip(long)
method.??????? java.io.Reader
nullReader, transferTo
-
???????
-
ProxyReader
Constructs a new ProxyReader.- ??:
proxy
- the Reader to delegate to
-
-
??????
-
read
Invokes the delegate'sread()
method.- ??:
read
???FilterReader
- ??:
- the character read or -1 if the end of stream
- ??:
IOException
- if an I/O error occurs.
-
read
Invokes the delegate'sread(char[])
method.- ??:
read
???Reader
- ??:
chr
- the buffer to read the characters into- ??:
- the number of characters read or -1 if the end of stream
- ??:
IOException
- if an I/O error occurs.
-
read
Invokes the delegate'sread(char[], int, int)
method.- ??:
read
???FilterReader
- ??:
chr
- the buffer to read the characters intost
- The start offsetlen
- The number of bytes to read- ??:
- the number of characters read or -1 if the end of stream
- ??:
IOException
- if an I/O error occurs.
-
read
Invokes the delegate'sread(CharBuffer)
method.- ???:
read
????Readable
- ??:
read
???Reader
- ??:
target
- the char buffer to read the characters into- ??:
- the number of characters read or -1 if the end of stream
- ??:
IOException
- if an I/O error occurs.- ???????:
- 2.0
-
skip
Invokes the delegate'sskip(long)
method.- ??:
skip
???FilterReader
- ??:
ln
- the number of bytes to skip- ??:
- the number of bytes to skipped or EOF if the end of stream
- ??:
IOException
- if an I/O error occurs.
-
ready
Invokes the delegate'sready()
method.- ??:
ready
???FilterReader
- ??:
- true if the stream is ready to be read
- ??:
IOException
- if an I/O error occurs.
-
close
Invokes the delegate'sclose()
method.- ???:
close
????AutoCloseable
- ???:
close
????Closeable
- ??:
close
???FilterReader
- ??:
IOException
- if an I/O error occurs.
-
mark
Invokes the delegate'smark(int)
method.- ??:
mark
???FilterReader
- ??:
idx
- read ahead limit- ??:
IOException
- if an I/O error occurs.
-
reset
Invokes the delegate'sreset()
method.- ??:
reset
???FilterReader
- ??:
IOException
- if an I/O error occurs.
-
markSupported
Invokes the delegate'smarkSupported()
method.- ??:
markSupported
???FilterReader
- ??:
- true if mark is supported, otherwise false
-
beforeRead
Invoked by the read methods before the call is proxied. The number of chars that the caller wanted to read (1 for theread()
method, buffer length forread(char[])
, etc.) is given as an argument.Subclasses can override this method to add common pre-processing functionality without having to override all the read methods. The default implementation does nothing.
Note this method is not called from
skip(long)
orreset()
. You need to explicitly override those methods if you want to add pre-processing steps also to them.- ??:
n
- number of chars that the caller asked to be read- ??:
IOException
- if the pre-processing fails- ???????:
- 2.0
-
afterRead
Invoked by the read methods after the proxied call has returned successfully. The number of chars returned to the caller (or -1 if the end of stream was reached) is given as an argument.Subclasses can override this method to add common post-processing functionality without having to override all the read methods. The default implementation does nothing.
Note this method is not called from
skip(long)
orreset()
. You need to explicitly override those methods if you want to add post-processing steps also to them.- ??:
n
- number of chars read, or -1 if the end of stream was reached- ??:
IOException
- if the post-processing fails- ???????:
- 2.0
-
handleIOException
Handle any IOExceptions thrown.This method provides a point to implement custom exception handling. The default behavior is to re-throw the exception.
- ??:
e
- The IOException thrown- ??:
IOException
- if an I/O error occurs.- ???????:
- 2.0
-