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, getReader, getTitle, hashCode, setData, setHref, setId, setInputEncoding, setMediaType, setTitle, toString
public 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
- IOException
public InputStream getInputStream() throws IOException
getInputStream
in class Resource
IOException
public void initialize() throws IOException
IOException
public byte[] getData() throws IOException
getData
in class Resource
IOException
public void close()
public boolean isInitialized()
Copyright © 2009–2017. All rights reserved.