public static class AbstractOrigin.ByteArrayOrigin extends AbstractOrigin<byte[],AbstractOrigin.ByteArrayOrigin>
byte[]
origin.AbstractOrigin.ByteArrayOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin
origin
Constructor and Description |
---|
ByteArrayOrigin(byte[] origin)
Constructs a new instance for the given origin.
|
Modifier and Type | Method and 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.
|
long |
size()
Gets the size of the origin, if possible.
|
get, getByteArray, getCharSequence, getFile, getOutputStream, getPath, getWriter, toString
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asSupplier
public ByteArrayOrigin(byte[] origin)
origin
- The origin.public byte[] getByteArray()
AbstractOrigin
getByteArray
in class AbstractOrigin<byte[],AbstractOrigin.ByteArrayOrigin>
public java.io.InputStream getInputStream(java.nio.file.OpenOption... options) throws java.io.IOException
AbstractOrigin
getInputStream
in class AbstractOrigin<byte[],AbstractOrigin.ByteArrayOrigin>
options
- options specifying how the file is openedjava.io.IOException
- if an I/O error occurs.public java.io.Reader getReader(java.nio.charset.Charset charset) throws java.io.IOException
AbstractOrigin
getReader
in class AbstractOrigin<byte[],AbstractOrigin.ByteArrayOrigin>
charset
- the charset to use for decodingjava.io.IOException
- if an I/O error occurs opening the file.public long size() throws java.io.IOException
AbstractOrigin
size
in class AbstractOrigin<byte[],AbstractOrigin.ByteArrayOrigin>
java.io.IOException
- if an I/O error occurs.