Package org.apache.commons.io.build
Class AbstractOrigin.InputStreamOrigin
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOrigin<java.io.InputStream,AbstractOrigin.InputStreamOrigin>
-
- org.apache.commons.io.build.AbstractOrigin.InputStreamOrigin
-
- All Implemented Interfaces:
IOSupplier<java.io.InputStream>
- Enclosing class:
- AbstractOrigin<T,B extends AbstractOrigin<T,B>>
public static class AbstractOrigin.InputStreamOrigin extends AbstractOrigin<java.io.InputStream,AbstractOrigin.InputStreamOrigin>
AnInputStream
origin.This origin cannot provide some of the other aspects.
-
-
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 InputStreamOrigin(java.io.InputStream 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.io.InputStream
getInputStream(java.nio.file.OpenOption... options)
Gets this origin as an InputStream, if possible.java.io.Reader
getReader(java.nio.charset.Charset charset)
Gets a new Reader on the origin, buffered by default.-
Methods inherited from class org.apache.commons.io.build.AbstractOrigin
get, getByteArray, getCharSequence, getFile, getOutputStream, getPath, getWriter, size, 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() throws java.io.IOException
Description copied from class:AbstractOrigin
Gets this origin as a byte array, if possible.- Overrides:
getByteArray
in classAbstractOrigin<java.io.InputStream,AbstractOrigin.InputStreamOrigin>
- Returns:
- this origin as a byte array, if possible.
- Throws:
java.io.IOException
- if an I/O error occurs.
-
getInputStream
public java.io.InputStream getInputStream(java.nio.file.OpenOption... options)
Description copied from class:AbstractOrigin
Gets this origin as an InputStream, if possible.- Overrides:
getInputStream
in classAbstractOrigin<java.io.InputStream,AbstractOrigin.InputStreamOrigin>
- Parameters:
options
- options specifying how the file is opened- Returns:
- this origin as an InputStream, if possible.
-
getReader
public java.io.Reader getReader(java.nio.charset.Charset charset) throws java.io.IOException
Description copied from class:AbstractOrigin
Gets a new Reader on the origin, buffered by default.- Overrides:
getReader
in classAbstractOrigin<java.io.InputStream,AbstractOrigin.InputStreamOrigin>
- 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.
-
-