|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lizardtech.djvu.DjVuObject
com.lizardtech.djvu.DataPool
public class DataPool
This class impliments a random access view of buffered data.
Nested Class Summary | |
---|---|
class |
DataPool.CachedInputStream
This class is an input stream which spans the accessable data in a DataPool object. |
Field Summary | |
---|---|
static java.util.Hashtable |
cache
Object for caching raw data. |
Fields inherited from class com.lizardtech.djvu.DjVuObject |
---|
hasReferences |
Constructor Summary | |
---|---|
DataPool()
Creates a new DataPool object. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Create a copy of this data pool which will refere to the original as a parent to read data. |
ByteVector |
createByteVector()
Create a new ByteVector. |
static DataPool |
createDataPool(DjVuInterface ref)
Creates an instance of DataPool with the options interherited from the specified reference. |
static DataPool |
createDataPool(DjVuInterface ref,
java.net.URL url)
Called to convert a URL to a DataPool. |
DataPool.CachedInputStream |
createInputStream()
Created a DataPool.CachedInputStream to read the data from. |
protected ByteVector |
getBuffer()
Query the buffer. |
ByteVector |
getData(int targetSize)
Read the data of the underlying DataPool up until the targetSize or EOF. |
int |
getEndOffset()
Query the end position of this pool. |
DataPool |
getParent()
Query the parent pool. |
int |
getPosition()
Query the end position of buffered data. |
int |
getStartOffset()
Query the start offset of this pool. |
java.net.URL |
getUrl()
Queries the URL used to create this stream. |
DataPool |
init(DataPool parent,
int startOffset,
int endOffset)
Initialize this pool to read data from a parent using the specified range. |
DataPool |
init(java.io.InputStream input)
Initialize the DataPool with the specified input stream |
DataPool |
init(java.net.URL url,
boolean prefetch)
Initialize the DataPool with the specified url. |
void |
prefetch()
Prefetched datain a separate thread. |
java.lang.String |
readUTF()
Convert the accessable data into a string. |
protected void |
setBuffer(ByteVector buffer)
Set a new buffer. |
void |
setEndOffset(int offset)
Adjust the endOffset of the DataPool. |
void |
setStartOffset(int offset)
Adjust the startOffset of the DataPool. |
byte[] |
toSizedByteArray()
Convert the accessable data into an array of bytes, with the first two bytes equal to the array length. |
Methods inherited from class com.lizardtech.djvu.DjVuObject |
---|
checkLockTime, create, create, createSoftReference, createWeakReference, getDjVuOptions, getFromReference, invoke, setDjVuOptions |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.Hashtable cache
Constructor Detail |
---|
public DataPool()
Method Detail |
---|
public void setEndOffset(int offset)
offset
- DOCUMENT ME!public int getEndOffset()
public DataPool getParent()
public void setStartOffset(int offset)
offset
- the now start offset of this DataPoolpublic int getStartOffset()
public java.net.URL getUrl()
public static DataPool createDataPool(DjVuInterface ref)
ref
- Object to interherit DjVuOptions from.
public static DataPool createDataPool(DjVuInterface ref, java.net.URL url)
ref
- Object to interherit DjVuOptions from.url
- The URL to open.
public ByteVector getData(int targetSize) throws java.io.IOException
targetSize
- the maximum amount of data to read.
java.io.IOException
- if an io error occurs.public java.lang.Object clone()
clone
in class java.lang.Object
public ByteVector createByteVector()
public DataPool.CachedInputStream createInputStream()
public DataPool init(DataPool parent, int startOffset, int endOffset)
parent
- pool containing the data sourcestartOffset
- start position to read fromendOffset
- end position to read to
public DataPool init(java.io.InputStream input)
input
- stream to read
public DataPool init(java.net.URL url, boolean prefetch)
url
- to readprefetch
- true if data should be prefetched in a separate thread
public void prefetch()
public java.lang.String readUTF() throws java.io.IOException
java.io.IOException
- if an error occurspublic byte[] toSizedByteArray() throws java.io.IOException
java.io.IOException
- if an error occursprotected void setBuffer(ByteVector buffer)
buffer
- the new ByteVector to useprotected ByteVector getBuffer()
public int getPosition()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |