Package com.opengamma.strata.collect.io
Class UriByteSource
- java.lang.Object
-
- com.google.common.io.ByteSource
-
- com.opengamma.strata.collect.io.BeanByteSource
-
- com.opengamma.strata.collect.io.UriByteSource
-
- All Implemented Interfaces:
Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class UriByteSource extends BeanByteSource implements org.joda.beans.ImmutableBean, Serializable
A byte source implementation that obtains data from a URI.This implementation differs from Guava in that it is a Joda-Bean. In addition,
BeanByteSource.read()throwsUncheckedIOExceptioninstead ofIOException.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)Optional<String>getFileName()Gets the file name of the source.URIgetUri()Gets the URI.inthashCode()ArrayByteSourceload()Loads the content of the byte source into memory.org.joda.beans.MetaBeanmetaBean()static UriByteSourceof(URI uri)Creates an instance based on the underlying URI.static UriByteSourceof(URL url)Creates an instance based on the underlying URL.InputStreamopenStream()StringtoString()-
Methods inherited from class com.opengamma.strata.collect.io.BeanByteSource
asCharSource, asCharSourceUtf8, asCharSourceUtf8UsingBom, getFileNameOrThrow, hash, isEmpty, read, readUtf8, readUtf8UsingBom, size, toBase64, toBase64String, toHash, toHashString
-
Methods inherited from class com.google.common.io.ByteSource
concat, concat, concat, contentEquals, copyTo, copyTo, empty, openBufferedStream, read, sizeIfKnown, slice, wrap
-
-
-
-
Method Detail
-
of
public static UriByteSource of(URI uri)
Creates an instance based on the underlying URI.- Parameters:
uri- the URI- Returns:
- the byte source
-
of
public static UriByteSource of(URL url)
Creates an instance based on the underlying URL.- Parameters:
url- the URL- Returns:
- the byte source
-
metaBean
public org.joda.beans.MetaBean metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getFileName
public Optional<String> getFileName()
Description copied from class:BeanByteSourceGets the file name of the source.Most sources originate from a file-based location. This is captured and returned here where available.
- Overrides:
getFileNamein classBeanByteSource- Returns:
- the file name, empty if not known
-
getUri
public URI getUri()
Gets the URI.- Returns:
- the URI
-
openStream
public InputStream openStream() throws IOException
- Specified by:
openStreamin classByteSource- Throws:
IOException
-
load
public ArrayByteSource load()
Description copied from class:BeanByteSourceLoads the content of the byte source into memory.- Overrides:
loadin classBeanByteSource- Returns:
- the byte array
-
-