public static class AbstractOrigin.CharSequenceOrigin extends AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
CharSequence
origin.AbstractOrigin.ByteArrayOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin
Constructor and Description |
---|
CharSequenceOrigin(CharSequence 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.
|
CharSequence |
getCharSequence(Charset charset)
Gets this origin as a byte array, if possible.
|
InputStream |
getInputStream(OpenOption... options)
Gets this origin as an InputStream, if possible.
|
Reader |
getReader(Charset charset)
Gets a new Reader on the origin, buffered by default.
|
long |
size()
Gets the size of the origin, if possible.
|
get, getByteArray, getFile, getOutputStream, getPath, getWriter, toString
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asSupplier
public CharSequenceOrigin(CharSequence origin)
origin
- The origin.public byte[] getByteArray()
AbstractOrigin
getByteArray
in class AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
public CharSequence getCharSequence(Charset charset)
AbstractOrigin
getCharSequence
in class AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
charset
- The charset to use if conversion from bytes is needed.public InputStream getInputStream(OpenOption... options) throws IOException
AbstractOrigin
getInputStream
in class AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
options
- options specifying how the file is openedIOException
- if an I/O error occurs.public Reader getReader(Charset charset) throws IOException
AbstractOrigin
getReader
in class AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
charset
- the charset to use for decodingIOException
- if an I/O error occurs opening the file.public long size() throws IOException
AbstractOrigin
size
in class AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>
IOException
- if an I/O error occurs.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.