-
- All Implemented Interfaces:
-
org.readium.r2.shared.util.SuspendingCloseable,org.readium.r2.shared.util.data.Readable,org.readium.r2.shared.util.resource.Resource
public final class HttpResource implements Resource
Provides access to an external URL through HTTP.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classHttpResource.Companion
-
Field Summary
Fields Modifier and Type Field Description private final AbsoluteUrlsourceUrl
-
Constructor Summary
Constructors Constructor Description HttpResource(AbsoluteUrl sourceUrl, HttpClient client, Long maxSkipBytes)
-
Method Summary
Modifier and Type Method Description AbsoluteUrlgetSourceUrl()URL locating this resource, if any. Try<Resource.Properties, ReadError>properties()Properties associated to the resource. Try<Long, ReadError>length()Returns data length from metadata if available, or calculated from reading the bytes otherwise. Unitclose()Closes this object and releases any resources associated with it. Try<ByteArray, ReadError>read(LongRange range)Reads the bytes at the given range. -
-
Constructor Detail
-
HttpResource
HttpResource(AbsoluteUrl sourceUrl, HttpClient client, Long maxSkipBytes)
-
-
Method Detail
-
getSourceUrl
AbsoluteUrl getSourceUrl()
URL locating this resource, if any.
-
properties
Try<Resource.Properties, ReadError> properties()
Properties associated to the resource.
This is opened for extensions.
-
length
Try<Long, ReadError> length()
Returns data length from metadata if available, or calculated from reading the bytes otherwise.
This value must be treated as a hint, as it might not reflect the actual bytes length. To get the real length, you need to read the whole resource.
-
close
Unit close()
Closes this object and releases any resources associated with it. If the object is already closed then invoking this method has no effect.
-
-
-
-