public class LazyResource extends Resource
data, originalHref| Constructor and Description |
|---|
LazyResource(InputStream in,
String filename,
int length,
String href)
Creates a Resource that tries to load the data, but falls back to lazy loading.
|
LazyResource(String filename,
long size,
String href)
Creates a Lazy resource, by not actually loading the data for this entry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Tells this resource to release its cached data.
|
byte[] |
getData()
The contents of the resource as a byte[]
If this resource was lazy-loaded and the data was not yet loaded,
it will be loaded into memory at this point.
|
InputStream |
getInputStream()
Gets the contents of the Resource as an InputStream.
|
long |
getSize()
Returns the size of this resource in bytes.
|
void |
initialize()
Initializes the resource by loading its data into memory.
|
boolean |
isInitialized()
Returns if the data for this resource has been loaded into memory.
|
equals, getHref, getId, getInputEncoding, getMediaType, getOriginalHref, getReader, getTitle, getTocHref, hashCode, setData, setHref, setId, setInputEncoding, setMediaType, setTitle, setTocHref, toStringpublic LazyResource(String filename, long size, String href)
fileName - the fileName for the epub we're created from.size - the size of this resource.href - The resource's href within the epub.public LazyResource(InputStream in, String filename, int length, String href) throws IOException
in - fileName - length - href - IOExceptionpublic InputStream getInputStream() throws IOException
getInputStream in class ResourceIOExceptionpublic void initialize()
throws IOException
IOExceptionpublic byte[] getData()
throws IOException
getData in class ResourceIOExceptionpublic void close()
public boolean isInitialized()
Copyright © 2009–2017. All rights reserved.