Copyright © Rasmus Sten and contributors, 1997-2004

nu.dll.lyskom
Class Text

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

public class Text
extends Hollerith
implements java.io.Serializable

Represents a LysKOM text. An application can construct Text objects and use the Session.createText(Text) call to create them on the server. The call Session.getText(int) also returns Text objects.
Most information about the text's status can be found in its TextStat object and the corresponding MiscInfo list.

See Also:
getStat(), TextStat, Session.getText(int), Session.createText(Text), Serialized Form

Field Summary
 
Fields inherited from class nu.dll.lyskom.KomToken
ARRAY, COMPL, HOLLERITH, PRIMITIVE
 
Constructor Summary
Text()
          Creates an empty text.
Text(byte[] contents)
          Creates a new text with the supplied contents
Text(java.lang.String subject, java.lang.String body)
          Creates a new text with the supplied subject and body, converted into bytes using the default encoding iso-8559-1.
 
Method Summary
 nu.dll.lyskom.Text addCcRecipient(int no)
          Adds one CC-recipient to this text.
 nu.dll.lyskom.Text addCcRecipients(int[] no)
          Adds an array of recipients as CC-recipients to this text.
 nu.dll.lyskom.Text addCommented(int no)
          Adds a text-number to which this is a comment.
 nu.dll.lyskom.Text addFootnoted(int no)
          Adds a text number to which this is a footnore.
 void addMiscInfoEntry(int key, int value)
          Deprecated. moved to TextStat class
 nu.dll.lyskom.Text addRecipient(int no)
          Adds a recipient to this text.
 nu.dll.lyskom.Text addRecipients(int[] no)
          Adds an array of recipients to this text.
 void clearMiscInfoEntry(int key)
          Deprecated. moved to TextStat class
 void clearRecipients()
          Removes all standard recipients in this text.
 java.lang.Object clone()
          Clones a text by copying its contents and recipient lists into a new Text object, which is then returnesd.
 int getAuthor()
          Return the author of this text.
 nu.dll.lyskom.Hollerith[] getAuxData(int tag)
          Returns the AuxItem data for a given AuxItem tag.
 java.util.List getAuxItems(int tag)
           
 byte[] getBody()
          Returns the body (everything but the first row) of this text.
 java.util.List getBodyList()
          Returns the body of this text as a List of String objects, converted from bytes using server encoding.
 int[] getCcRecipients()
          Returns an array containing all CC-recipients for this text.
 java.lang.String getCharset()
           
 int[] getCommented()
          Returns an array containing all the texts of which this is a comment to.
 int[] getComments()
          Returns an array containing all comments to this text.
 java.lang.String getContentType()
           
 java.util.Date getCreationTime()
          Returns the time at which this text was created.
 java.lang.String getCreationTimeString()
          Returns a string represantation of the time at which this text was created.
 int[] getFootnoted()
          Returns an array of all texts to which this text is a footnote to.
 int[] getFootnotes()
          Returns an array of all footnotes to this text.
 int getLocal(int confNo)
          Walks through the recipient list of this text and return this texts local text number for that recipient, or -1 if the recipient is not found in this texts recipient list.
 int getNo()
          Returns the number of this text.
 int[] getRecipients()
          Returns an array containing all recipients for this text.
 int getRows()
          Count the number of rows this text contains.
 int[] getSenders()
          Returns an array of all that has sent this text to new recipient.
 int[] getSendTimes()
          Returns an array of the times when people has added new recipients to this text.
 nu.dll.lyskom.TextStat getStat()
          Returns the TextStat object containing information about this text's status (such as recipients, footnotes, et.c.).
 int[] getStatInts(int no)
          Deprecated. moved to TextStat
 byte[] getSubject()
          Returns the subject (first row) of this text.
 boolean isCached(boolean n)
          Returns true if this text was retreived from text cache rather than directly from the server
 void removeCcRecipient(int conf)
          Removes a CC-recipient from this text.
 void removeMiscInfoEntry(int key, int value)
          Deprecated. moved to TextStat class
 void removeRecipient(int conf)
          Removes a recipient from this text.
 void setStat(nu.dll.lyskom.TextStat stat)
          Sets the TextStat object for this text.
 void trimContents()
          Trims the contents on this text - removes trailing whitespace to follow LysKOM conventions.
 
Methods inherited from class nu.dll.lyskom.Hollerith
getContentString, toNetwork, toString
 
Methods inherited from class nu.dll.lyskom.KomToken
equals, getContents, getType, intValue, isEol, setContents, toInt, toInteger
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Text

public Text()
Creates an empty text.


Text

public Text(java.lang.String subject,
            java.lang.String body)
Creates a new text with the supplied subject and body, converted into bytes using the default encoding iso-8559-1.


Text

public Text(byte[] contents)
Creates a new text with the supplied contents

Method Detail

isCached

public boolean isCached(boolean n)
Returns true if this text was retreived from text cache rather than directly from the server


getCharset

public java.lang.String getCharset()
Overrides:
getCharset in class Hollerith

getContentType

public java.lang.String getContentType()

trimContents

public void trimContents()
Trims the contents on this text - removes trailing whitespace to follow LysKOM conventions.


getRows

public int getRows()
Count the number of rows this text contains.


getAuthor

public int getAuthor()
Return the author of this text.


getAuxData

public nu.dll.lyskom.Hollerith[] getAuxData(int tag)
Returns the AuxItem data for a given AuxItem tag.

See Also:
AuxItem

getAuxItems

public java.util.List getAuxItems(int tag)

addRecipients

public nu.dll.lyskom.Text addRecipients(int[] no)
Adds an array of recipients to this text.


addRecipient

public nu.dll.lyskom.Text addRecipient(int no)
Adds a recipient to this text.


clearRecipients

public void clearRecipients()
Removes all standard recipients in this text.


removeRecipient

public void removeRecipient(int conf)
Removes a recipient from this text.


removeCcRecipient

public void removeCcRecipient(int conf)
Removes a CC-recipient from this text.


addCcRecipients

public nu.dll.lyskom.Text addCcRecipients(int[] no)
Adds an array of recipients as CC-recipients to this text.


addCcRecipient

public nu.dll.lyskom.Text addCcRecipient(int no)
Adds one CC-recipient to this text.


clone

public java.lang.Object clone()
Clones a text by copying its contents and recipient lists into a new Text object, which is then returnesd.

Overrides:
clone in class java.lang.Object

clearMiscInfoEntry

public void clearMiscInfoEntry(int key)
Deprecated. moved to TextStat class


removeMiscInfoEntry

public void removeMiscInfoEntry(int key,
                                int value)
Deprecated. moved to TextStat class


addMiscInfoEntry

public void addMiscInfoEntry(int key,
                             int value)
Deprecated. moved to TextStat class


addCommented

public nu.dll.lyskom.Text addCommented(int no)
Adds a text-number to which this is a comment.


addFootnoted

public nu.dll.lyskom.Text addFootnoted(int no)
Adds a text number to which this is a footnore.


getLocal

public int getLocal(int confNo)
             throws java.lang.RuntimeException
Walks through the recipient list of this text and return this texts local text number for that recipient, or -1 if the recipient is not found in this texts recipient list.

Parameters:
confNo - The recipient to search for
java.lang.RuntimeException
See Also:
Session.localToGlobal(int, int, int), TextMapping

getSubject

public byte[] getSubject()
Returns the subject (first row) of this text.


getBody

public byte[] getBody()
Returns the body (everything but the first row) of this text.


getBodyList

public java.util.List getBodyList()
Returns the body of this text as a List of String objects, converted from bytes using server encoding.


getStatInts

public int[] getStatInts(int no)
Deprecated. moved to TextStat

Returns an int[] for Misc-Info members with integer values

See Also:
TextStat.getStatInts(int)

getCreationTime

public java.util.Date getCreationTime()
Returns the time at which this text was created.


getCreationTimeString

public java.lang.String getCreationTimeString()
Returns a string represantation of the time at which this text was created.


getRecipients

public int[] getRecipients()
Returns an array containing all recipients for this text.


getCcRecipients

public int[] getCcRecipients()
Returns an array containing all CC-recipients for this text.


getCommented

public int[] getCommented()
Returns an array containing all the texts of which this is a comment to.


getComments

public int[] getComments()
Returns an array containing all comments to this text.


getFootnoted

public int[] getFootnoted()
Returns an array of all texts to which this text is a footnote to.


getFootnotes

public int[] getFootnotes()
Returns an array of all footnotes to this text.


getSenders

public int[] getSenders()
Returns an array of all that has sent this text to new recipient. Note that this list is NOT consistent with getRecipients()!


getSendTimes

public int[] getSendTimes()
Returns an array of the times when people has added new recipients to this text. Note that this list is NOT consistent with getRecipients()!


setStat

public void setStat(nu.dll.lyskom.TextStat stat)
Sets the TextStat object for this text.


getStat

public nu.dll.lyskom.TextStat getStat()
Returns the TextStat object containing information about this text's status (such as recipients, footnotes, et.c.). It is the TextStat object you should use to get detailed recipient and sender information.


getNo

public int getNo()
Returns the number of this text.


Copyright © Rasmus Sten and contributors, 1997-2004