Class AbstractOrigin.ReaderOrigin
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<Reader, AbstractOrigin.ReaderOrigin>
org.apache.commons.io.build.AbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>
org.apache.commons.io.build.AbstractOrigin.ReaderOrigin
- All Implemented Interfaces:
IOSupplier<Reader>
- Enclosing class:
AbstractOrigin<T, B extends AbstractOrigin<T,B>>
public static class AbstractOrigin.ReaderOrigin
extends AbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>
A
Reader origin.
This origin cannot provide conversions to other aspects.
- Since:
- 2.12.0
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractOrigin
AbstractOrigin.AbstractRandomAccessFileOrigin<T,B>, AbstractOrigin.ByteArrayOrigin, AbstractOrigin.ChannelOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.IORandomAccessFileOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.RandomAccessFileOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets this origin as a byte array, if possible.protected ChannelgetChannel(OpenOption... options) Gets this origin as a Channel, if possible.getCharSequence(Charset charset) Gets this origin as a byte array, if possible.getInputStream(OpenOption... options) Gets this origin as an InputStream, if possible.Gets a new Reader on the origin, buffered by default.Methods inherited from class AbstractOrigin
get, getByteArray, getChannel, getFile, getOutputStream, getPath, getRandomAccessFile, getWriter, size, toStringMethods inherited from class AbstractSupplier
asThisMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IOSupplier
asSupplier, getUnchecked
-
Constructor Details
-
ReaderOrigin
Constructs a new instance for the given origin.- Parameters:
origin- The origin, not null.- Throws:
NullPointerException- iforiginisnull.
-
-
Method Details
-
getByteArray
Description copied from class:AbstractOriginGets this origin as a byte array, if possible.- Overrides:
getByteArrayin classAbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>- Returns:
- this origin as a byte array, if possible.
- Throws:
IOException- if an I/O error occurs.
-
getChannel
Description copied from class:AbstractOriginGets this origin as a Channel, if possible.- Overrides:
getChannelin classAbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>- Parameters:
options- Options specifying how a file-based origin is opened, ignored otherwise.- Returns:
- A new Channel on the origin.
- Throws:
IOException- If an I/O error occurs.- See Also:
-
getCharSequence
Gets this origin as a byte array, if possible.The
charsetparameter is ignored since aReaderdoes not need aCharsetto be read.- Overrides:
getCharSequencein classAbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>- Parameters:
charset- The charset to use if conversion from bytes is needed.- Returns:
- this origin as a byte array, if possible.
- Throws:
IOException- if an I/O error occurs.
-
getInputStream
Gets this origin as an InputStream, if possible.The
optionsparameter is ignored since aReaderdoes not need anOpenOptionto be read.- Overrides:
getInputStreamin classAbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>- Parameters:
options- options specifying how the file is opened- Returns:
- this origin as an InputStream, if possible.
- Throws:
IOException- if an I/O error occurs.
-
getReader
Gets a new Reader on the origin, buffered by default.The
charsetparameter is ignored since aReaderdoes not need aCharsetto be read.No conversion should occur when calling this method.
- Overrides:
getReaderin classAbstractOrigin<Reader, AbstractOrigin.ReaderOrigin>- Parameters:
charset- the charset to use for decoding, null maps to the default Charset.- Returns:
- a new Reader on the origin.
- Throws:
IOException- if an I/O error occurs opening the file.
-