public class ReaderWrapper extends Object implements Closeable
Reader instance. This wrapper is
intended to wrap Reader instances for use with CloseableRegistry, hence such instances should not be closed
directly, that is, without going through the wrapper's close() method.| Constructor and Description |
|---|
ReaderWrapper(File file)
Creates a new wrapped reader that wraps the given regular file.
|
ReaderWrapper(File file,
DecodingStrategy decodingStrategy)
Creates a new wrapped reader that wraps the given regular
file.
|
ReaderWrapper(Reader reader)
Creates a new wrapped reader that wraps the given reader.
|
ReaderWrapper(Reader reader,
boolean skipClose)
Creates a new wrapped reader that wraps the given reader.
|
ReaderWrapper(String name)
Creates a new wrapped reader that wraps the regular file with
the given name, or the standard input stream (if the name is
SpecialNames.STANDARD_INPUT). |
ReaderWrapper(String name,
DecodingStrategy decodingStrategy)
Creates a new wrapped reader that wraps the regular file with
the given name, or the standard input stream (if the name is
SpecialNames.STANDARD_INPUT). |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Reader |
getReader()
Returns the receiver's underlying reader.
|
boolean |
getSkipClose()
Returns true if the receiver's underlying reader will not be
closed when
close() is called. |
public ReaderWrapper(String name, DecodingStrategy decodingStrategy) throws FileNotFoundException
SpecialNames.STANDARD_INPUT). A reader that recognizes
unicode BOMs is used as a proxy; that reader uses the given
decoding strategy.name - The file name.decodingStrategy - The decoding strategy. It may be null
to use the default JVM charset.FileNotFoundException - Thrown if the name represents a
regular file, and it cannot be opened for reading.public ReaderWrapper(String name) throws FileNotFoundException
SpecialNames.STANDARD_INPUT). The default JVM charset
is used to convert bytes into characters.name - The file name.FileNotFoundException - Thrown if the name represents a
regular file, and it cannot be opened for reading.public ReaderWrapper(File file, DecodingStrategy decodingStrategy) throws FileNotFoundException
file - The file.decodingStrategy - The decoding strategy. It may be null
to use the default JVM charset.FileNotFoundException - Thrown if the file cannot be
opened for reading.public ReaderWrapper(File file) throws FileNotFoundException
file - The file.FileNotFoundException - Thrown if the file cannot be
opened for reading.public ReaderWrapper(Reader reader, boolean skipClose)
close() is
called depending on the given flag.reader - The reader.skipClose - True if the underlying reader should not be
closed.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Reader getReader()
public boolean getSkipClose()
close() is called.Copyright © 2015. All Rights Reserved.