Copyright © Rasmus Sten and contributors, 1997-2004

nu.dll.lyskom
Class BigText

java.lang.Object
  |
  +--nu.dll.lyskom.KomToken
        |
        +--nu.dll.lyskom.Hollerith
              |
              +--nu.dll.lyskom.Text
                    |
                    +--nu.dll.lyskom.BigText
All Implemented Interfaces:
java.io.Serializable

public class BigText
extends Text

(EXPERIMENTAL) A "big" text, intended to efficiently handle large messages such as binary files, often seen in mail attachments. The contents of a BigText is never stored in memory. Rather, the BigText objects stores a reference of the Session that contains the data, and retreives it on demand. Care must be taken when handling the HollerithStream objects returned by this class, since they provide a direct interface to the server, and may as such screw up server I/O if not treated properly. See the HollerithStream API documentation for more information. An application that uses the big-text feature of LatteKOM should test with instanceof whether a text is a Text or a BigText object. If it is a BigText, it should use getBodyStream() instead of getBody() in order to read out the texts contents. To enable the big-text feature, set the system property "lyskom.big-text" to "true" (defaults to false). LatteKOM will then use the values of the system properties "lyskom.big-text-limit" (default 51200 bytes) and "lyskom.big-text-head" (default 100 bytes) to determine the maximum text size for RAM-allocatable texts, and the text truncation limit, respectively. If a text exceeds the big-text-limit, a BigText stub object will be created, containing only the first big-text-head bytes. The default value of big-text-head is usually sufficient to extract the subject, and in most aspects, a BigText object can be treated as a regular Text. Care should be taken not to call getContents() of a BigText object, since it will defeat it's purpose of memory efficiency, and instead place an extra burden on both client and server, as the entire text contents will be requested from the server on each call and mapped into memory, but never cached.

Author:
Rasmus Sten
See Also:
HollerithStream, Serialized Form

Field Summary
 
Fields inherited from class nu.dll.lyskom.KomToken
ARRAY, COMPL, HOLLERITH, PRIMITIVE
 
Method Summary
 nu.dll.lyskom.HollerithStream getBodyStream()
          Returns a HollerithStream with the body of this text.
 byte[] getContents()
          Returns a byte array containing this texts entire contents.
 nu.dll.lyskom.HollerithStream getContentStream()
          Returns the entire contents (subject + "\n" + body) of this text as a stream.
 
Methods inherited from class nu.dll.lyskom.Text
addCcRecipient, addCcRecipients, addCommented, addFootnoted, addMiscInfoEntry, addRecipient, addRecipients, clearMiscInfoEntry, clearRecipients, clone, getAuthor, getAuxData, getAuxItems, getBody, getBodyList, getCcRecipients, getCharset, getCommented, getComments, getContentType, getCreationTime, getCreationTimeString, getFootnoted, getFootnotes, getLocal, getNo, getRecipients, getRows, getSenders, getSendTimes, getStat, getStatInts, getSubject, isCached, removeCcRecipient, removeMiscInfoEntry, removeRecipient, setStat, trimContents
 
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

getBodyStream

public nu.dll.lyskom.HollerithStream getBodyStream()
                                            throws java.io.IOException,
                                                   RpcFailure
Returns a HollerithStream with the body of this text.

java.io.IOException
RpcFailure
See Also:
HollerithStream

getContentStream

public nu.dll.lyskom.HollerithStream getContentStream()
                                               throws java.io.IOException,
                                                      RpcFailure
Returns the entire contents (subject + "\n" + body) of this text as a stream.

java.io.IOException
RpcFailure
See Also:
HollerithStream

getContents

public byte[] getContents()
Returns a byte array containing this texts entire contents. Note that this is very inefficient when dealing with very large "texts".

Overrides:
getContents in class KomToken

Copyright © Rasmus Sten and contributors, 1997-2004