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()
throwsUncheckedIOException
instead ofIOException
.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
Optional<String>
getFileName()
Gets the file name of the source.URI
getUri()
Gets the URI.int
hashCode()
ArrayByteSource
load()
Loads the content of the byte source into memory.org.joda.beans.MetaBean
metaBean()
static UriByteSource
of(URI uri)
Creates an instance based on the underlying URI.static UriByteSource
of(URL url)
Creates an instance based on the underlying URL.InputStream
openStream()
String
toString()
-
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:
metaBean
in interfaceorg.joda.beans.Bean
-
getFileName
public Optional<String> getFileName()
Description copied from class:BeanByteSource
Gets the file name of the source.Most sources originate from a file-based location. This is captured and returned here where available.
- Overrides:
getFileName
in 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:
openStream
in classByteSource
- Throws:
IOException
-
load
public ArrayByteSource load()
Description copied from class:BeanByteSource
Loads the content of the byte source into memory.- Overrides:
load
in classBeanByteSource
- Returns:
- the byte array
-
-