|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.document.read.Reader
public class Reader
The Reader
is responsible for loading and creating instances of Document.
Field Summary | |
---|---|
static int |
AFTER_LAST_PAGE
|
static int |
BEFORE_FIRST_PAGE
|
protected boolean |
complete
|
Constructor Summary | |
---|---|
Reader()
|
Method Summary | ||
---|---|---|
void |
addReaderListener(ReaderListener listener)
Add the given ReaderListener to the list of load listeners. |
|
void |
clearSettings(Class<? extends ReaderSettings> c)
|
|
void |
complete()
Signal the reader that the current read process is complete. |
|
protected com.levigo.jadice.document.internal.read.ReadTask |
createTask(Provider<? extends InputStream,IOException> streamProvider)
|
|
protected void |
finalize()
|
|
Document |
getDocument()
|
|
Format |
getFormat()
|
|
Map<DocumentLayer,DocumentLayer> |
getLayerMapping()
|
|
Metadata |
getMetadata()
|
|
Map<String,Object> |
getProperties()
Return a map of user properties. |
|
String |
getReadID()
|
|
|
getSettings(Class<S> c)
|
|
int |
getStreamIndex()
|
|
int |
getTargetIndex()
Get the target page index to be used for page segments read by the next call to read(InputStream) . |
|
protected void |
handleTask(com.levigo.jadice.document.internal.read.ReadTask task)
|
|
com.levigo.jadice.document.internal.read.ReadTask |
read(File file)
|
|
com.levigo.jadice.document.internal.read.ReadTask |
read(InputStream is)
|
|
com.levigo.jadice.document.internal.read.ReadTask |
read(Provider<? extends InputStream,IOException> streamProvider)
|
|
com.levigo.jadice.document.internal.read.ReadTask |
read(URL url)
Reads a document from the given URL . |
|
void |
removeReaderListener(ReaderListener listener)
Remove the given ReaderListener from the list of load listeners. |
|
void |
setDocument(Document document)
Sets the document. |
|
void |
setFormat(Format format)
|
|
void |
setLayerMapping(Map<DocumentLayer,DocumentLayer> mapping)
|
|
void |
setMetadata(Metadata metadata)
|
|
void |
setReaderControls(ReaderControls rc)
Replace the existing ReaderControls instance with all its ReaderSettings . |
|
void |
setReadID(String readID)
|
|
void |
setTargetIndex(int targetIndex)
Set the target page index to be used for page segments read by the next call to read(InputStream) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AFTER_LAST_PAGE
public static final int BEFORE_FIRST_PAGE
protected boolean complete
Constructor Detail |
---|
public Reader()
Method Detail |
---|
public void clearSettings(Class<? extends ReaderSettings> c)
public <S extends ReaderSettings> S getSettings(Class<S> c)
public void addReaderListener(ReaderListener listener)
ReaderListener
to the list of load listeners.
listener
- the listener to addpublic void removeReaderListener(ReaderListener listener)
ReaderListener
from the list of load listeners.
listener
- the listener to removepublic com.levigo.jadice.document.internal.read.ReadTask read(URL url) throws JadiceException, IOException, IllegalArgumentException
URL
.
url
- the URL
to be read.
ReadTask
used to execute the read request
JadiceException
IOException
- if an I/O error occurs
IllegalArgumentException
- if the given URL
is null
IllegalStateException
- it an attempt is made to read with an instance that has already
been marked as complete()
.public com.levigo.jadice.document.internal.read.ReadTask read(File file) throws JadiceException, IOException
file
- file to read
JadiceException
IOException
IllegalStateException
- it an attempt is made to read with an instance that has already
been marked as complete()
.public com.levigo.jadice.document.internal.read.ReadTask read(InputStream is) throws JadiceException, IOException
is
-
JadiceException
IOException
IllegalStateException
- it an attempt is made to read with an instance that has already
been marked as complete()
.public com.levigo.jadice.document.internal.read.ReadTask read(Provider<? extends InputStream,IOException> streamProvider) throws JadiceException, IOException
streamProvider
-
JadiceException
IOException
IllegalStateException
- it an attempt is made to read with an instance that has already
been marked as complete()
.protected com.levigo.jadice.document.internal.read.ReadTask createTask(Provider<? extends InputStream,IOException> streamProvider)
protected void handleTask(com.levigo.jadice.document.internal.read.ReadTask task) throws IOException, JadiceException
IOException
JadiceException
public Document getDocument()
public void setDocument(Document document)
document
- The document to setpublic int getTargetIndex()
read(InputStream)
.
BEFORE_FIRST_PAGE
and
AFTER_LAST_PAGE
.BEFORE_FIRST_PAGE
,
AFTER_LAST_PAGE
public void setTargetIndex(int targetIndex)
read(InputStream)
.
targetIndex
- the zero-based target index or one of the special cases
BEFORE_FIRST_PAGE
and AFTER_LAST_PAGE
.BEFORE_FIRST_PAGE
,
AFTER_LAST_PAGE
public Metadata getMetadata()
public void setMetadata(Metadata metadata)
public Map<String,Object> getProperties()
PropertiesProvider
getProperties
in interface PropertiesProvider
public Map<DocumentLayer,DocumentLayer> getLayerMapping()
public void setLayerMapping(Map<DocumentLayer,DocumentLayer> mapping)
public Format getFormat()
public void setFormat(Format format)
public void setReaderControls(ReaderControls rc)
ReaderControls
instance with all its ReaderSettings
.
Passing a null
-argument resets the internal controls instance to its initial
state.
public String getReadID()
public void setReadID(String readID)
public int getStreamIndex()
public void complete()
ReaderListener
s. Furthermore, on the Document
retrieved by
a call to getDocument()
, Document.BasicState.READY
is set as the new state. After
calling this method, further calls to any of the read(...)
methods will result in
IllegalStateException
s.
Using this method is encouraged, but not mandatory.
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |