Package org.apache.commons.io.build
Class AbstractOrigin.CharSequenceOrigin
- java.lang.Object
 - 
- org.apache.commons.io.build.AbstractSupplier<T,B>
 - 
- org.apache.commons.io.build.AbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>
 - 
- org.apache.commons.io.build.AbstractOrigin.CharSequenceOrigin
 
 
 
 
- 
- All Implemented Interfaces:
 IOSupplier<java.lang.CharSequence>
- Enclosing class:
 - AbstractOrigin<T,B extends AbstractOrigin<T,B>>
 
public static class AbstractOrigin.CharSequenceOrigin extends AbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>
ACharSequenceorigin. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class org.apache.commons.io.build.AbstractOrigin
AbstractOrigin.ByteArrayOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin 
 - 
 
- 
Constructor Summary
Constructors Constructor Description CharSequenceOrigin(java.lang.CharSequence origin)Constructs a new instance for the given origin. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getByteArray()Gets this origin as a byte array, if possible.java.lang.CharSequencegetCharSequence(java.nio.charset.Charset charset)Gets this origin as a byte array, if possible.java.io.InputStreamgetInputStream(java.nio.file.OpenOption... options)Gets this origin as an InputStream, if possible.java.io.ReadergetReader(java.nio.charset.Charset charset)Gets a new Reader on the origin, buffered by default.longsize()Gets the size of the origin, if possible.- 
Methods inherited from class org.apache.commons.io.build.AbstractOrigin
get, getByteArray, getFile, getOutputStream, getPath, getWriter, toString 
- 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getByteArray
public byte[] getByteArray()
Description copied from class:AbstractOriginGets this origin as a byte array, if possible.- Overrides:
 getByteArrayin classAbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>- Returns:
 - this origin as a byte array, if possible.
 
 
- 
getCharSequence
public java.lang.CharSequence getCharSequence(java.nio.charset.Charset charset)
Gets this origin as a byte array, if possible.The
charsetparameter is ignored since aCharSequencedoes not need aCharsetto be read.- Overrides:
 getCharSequencein classAbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>- Parameters:
 charset- The charset to use if conversion from bytes is needed.- Returns:
 - this origin as a byte array, if possible.
 
 
- 
getInputStream
public java.io.InputStream getInputStream(java.nio.file.OpenOption... options) throws java.io.IOExceptionGets this origin as an InputStream, if possible.The
optionsparameter is ignored since aCharSequencedoes not need anOpenOptionto be read.- Overrides:
 getInputStreamin classAbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>- Parameters:
 options- options specifying how the file is opened- Returns:
 - this origin as an InputStream, if possible.
 - Throws:
 java.io.IOException- if an I/O error occurs.
 
- 
getReader
public java.io.Reader getReader(java.nio.charset.Charset charset) throws java.io.IOExceptionGets a new Reader on the origin, buffered by default.The
charsetparameter is ignored since aCharSequencedoes not need aCharsetto be read.- Overrides:
 getReaderin classAbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>- Parameters:
 charset- the charset to use for decoding- Returns:
 - a new Reader on the origin.
 - Throws:
 java.io.IOException- if an I/O error occurs opening the file.
 
- 
size
public long size() throws java.io.IOExceptionDescription copied from class:AbstractOriginGets the size of the origin, if possible.- Overrides:
 sizein classAbstractOrigin<java.lang.CharSequence,AbstractOrigin.CharSequenceOrigin>- Returns:
 - the size of the origin in bytes or characters.
 - Throws:
 java.io.IOException- if an I/O error occurs.
 
 - 
 
 -