|
Copyright © Rasmus Sten and contributors, 1997-2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nu.dll.lyskom.KomToken | +--nu.dll.lyskom.Hollerith | +--nu.dll.lyskom.HollerithStream
A HollerithStream provides an InputStream from which the contents of a Hollerith sent from the server can be read. It's main purpose is to enable effecient handling of very large texts, where it is not desirable to allocate the entire text contents in memory. The provided InputStream is a direct interface to the LysKOM server stream, which means that care must be taken not to interfere with the regular protocol parsing. When a HollerithStream has been retreived, all further reads from the server are blocked until the object's setExhausted() method has been called, signalling to the server reader that the stream has been read and that it may continue normal parsing. The InputStream returned by getStream() MUST NOT be closed through its close() method. Also it MUST NOT be read beyond the size of the HollerithStream as reported by the HollerithStream object's getSize() method. If an application does not want to read the entire contents of the Hollerith, it MUST call the cancel() method of the HollerithStream in order to let the rest of the contents to be discarded.
Field Summary |
Fields inherited from class nu.dll.lyskom.KomToken |
ARRAY, COMPL, HOLLERITH, PRIMITIVE |
Method Summary | |
void |
cancel()
Equal to cancel(0). |
void |
cancel(int offset)
Discards any remaining bytes in the InputStream, then marks the stream as exhausted. |
byte[] |
getContents()
Returnes a byte-array containing all data in the hollerith. |
int |
getSize()
Returns the size of the represented hollerith. |
java.io.InputStream |
getStream()
Returns an InputStream from which the contents can be read. |
boolean |
isExhausted()
Returns true if the provided InputStream is exhausted. |
void |
setExhausted()
Marks the stream as exhausted. |
Methods inherited from class nu.dll.lyskom.Hollerith |
getContentString, toNetwork, toString |
Methods inherited from class nu.dll.lyskom.KomToken |
equals, getType, intValue, isEol, setContents, toInt, toInteger |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public int getSize()
public java.io.InputStream getStream()
java.lang.IllegalStateException
- if the stream has already been marked as exhaustedpublic void cancel() throws java.io.IOException
java.io.IOException
public void cancel(int offset) throws java.io.IOException
java.io.IOException
public void setExhausted()
public boolean isExhausted()
public byte[] getContents()
getContents
in class KomToken
|
Copyright © Rasmus Sten and contributors, 1997-2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |