public final class FileByteSource extends BeanByteSource implements org.joda.beans.ImmutableBean, Serializable
This implementation differs from Guava in that it is a Joda-Bean.
In addition, BeanByteSource.read() throws UncheckedIOException instead of IOException.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
File |
getFile()
Gets the File.
|
Optional<String> |
getFileName()
Gets the file name of the source.
|
int |
hashCode() |
ArrayByteSource |
load()
Loads the content of the byte source into memory.
|
org.joda.beans.MetaBean |
metaBean() |
static FileByteSource |
of(File file)
Creates an instance based on the underlying file.
|
static FileByteSource |
of(Path path)
Creates an instance based on a file path.
|
InputStream |
openStream() |
long |
size()
Gets the size of the byte source, throwing an unchecked exception.
|
Optional<Long> |
sizeIfKnown() |
String |
toString() |
asCharSourceUtf8, asCharSourceUtf8UsingBom, hash, isEmpty, read, readUtf8, readUtf8UsingBom, toBase64, toBase64String, toHash, toHashStringasCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, openBufferedStream, read, slice, wrappublic static FileByteSource of(File file)
file - the filepublic static FileByteSource of(Path path)
path - the path to a filepublic org.joda.beans.MetaBean metaBean()
metaBean in interface org.joda.beans.Beanpublic Optional<String> getFileName()
BeanByteSourceMost sources originate from a file-based location. This is captured and returned here where available.
getFileName in class BeanByteSourcepublic File getFile()
public InputStream openStream() throws IOException
openStream in class ByteSourceIOExceptionpublic Optional<Long> sizeIfKnown()
sizeIfKnown in class ByteSourcepublic long size()
BeanByteSource
This overrides ByteSource to throw UncheckedIOException instead of IOException.
size in class BeanByteSourcepublic ArrayByteSource load()
BeanByteSourceload in class BeanByteSourceCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.