net.sf.jso.text
Class Text

java.lang.Object
  extended bynet.sf.jso.text.Text
All Implemented Interfaces:
java.lang.CharSequence, java.lang.Comparable, java.io.Serializable

public final class Text
extends java.lang.Object
implements java.lang.CharSequence, java.lang.Comparable, java.io.Serializable

Class that represents a text (long string) to be used by storable objects.

In storable objects strings are limited on length when stored, because of performance issues. Text objects, in contrast, do not have these limitations but demand extra effort for storage.

Whenever short length strings can be used String class should be used. If a string may contain a large amount of data, Text class should be used instead.

See Also:
Serialized Form

Constructor Summary
Text()
          Initializes a newly created Text object so that it represents an empty character sequence.
Text(byte[] bytes)
          Constructs a new Text by decoding the specified array of bytes using the platform's default charset.
Text(byte[] bytes, int offset, int length)
          Constructs a new Text by decoding the specified subarray of bytes using the platform's default charset.
Text(byte[] bytes, int offset, int length, java.lang.String charsetName)
          Constructs a new Text by decoding the specified subarray of bytes using the specified charset.
Text(byte[] bytes, java.lang.String charsetName)
          Constructs a new Text by decoding the specified array of bytes using the specified charset.
Text(char[] value)
          Allocates a new Text so that it represents the sequence of characters currently contained in the character array argument.
Text(char[] value, int offset, int count)
          Allocates a new String that contains characters from a subarray of the character array argument.
Text(java.lang.String original)
          Initializes a newly created Text object so that it represents the same sequence of characters as the argument; in other words, the newly created Text is a copy of the argument string.
Text(java.lang.StringBuffer buffer)
          Allocates a new Text that contains the sequence of characters currently contained in the string buffer argument.
Text(Text original)
          Initializes a newly created Text object so that it represents the same sequence of characters as the argument; in other words, the newly created Text is a copy of the argument Text.
 
Method Summary
 char charAt(int index)
          Returns the character at the specified index.
 int compareTo(java.lang.Object o)
          Compares this text to another object.
 int compareToIgnoreCase(Text t)
          Compares this text to another object, ignoring case considerations.
 boolean equals(java.lang.Object o)
          Compares this text to the specified object.
 boolean equalsIgnoreCase(Text t)
          Compares this text to the specified object, ignoring case considerations.
 int hashCode()
          Returns a hash code for this string.
 int length()
          Returns the length of this text.
 java.lang.CharSequence subSequence(int start, int end)
          Returns a new character sequence that is a subsequence of this text.
 java.lang.String toString()
          Returns a string containing the characters in this text.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Text

public Text()
Initializes a newly created Text object so that it represents an empty character sequence.


Text

public Text(byte[] bytes)
Constructs a new Text by decoding the specified array of bytes using the platform's default charset.


Text

public Text(byte[] bytes,
            int offset,
            int length)
Constructs a new Text by decoding the specified subarray of bytes using the platform's default charset.


Text

public Text(byte[] bytes,
            int offset,
            int length,
            java.lang.String charsetName)
     throws java.io.UnsupportedEncodingException
Constructs a new Text by decoding the specified subarray of bytes using the specified charset.


Text

public Text(byte[] bytes,
            java.lang.String charsetName)
     throws java.io.UnsupportedEncodingException
Constructs a new Text by decoding the specified array of bytes using the specified charset.


Text

public Text(char[] value)
Allocates a new Text so that it represents the sequence of characters currently contained in the character array argument.


Text

public Text(char[] value,
            int offset,
            int count)
Allocates a new String that contains characters from a subarray of the character array argument.


Text

public Text(java.lang.String original)
Initializes a newly created Text object so that it represents the same sequence of characters as the argument; in other words, the newly created Text is a copy of the argument string.


Text

public Text(java.lang.StringBuffer buffer)
Allocates a new Text that contains the sequence of characters currently contained in the string buffer argument.


Text

public Text(Text original)
Initializes a newly created Text object so that it represents the same sequence of characters as the argument; in other words, the newly created Text is a copy of the argument Text.

Method Detail

compareTo

public int compareTo(java.lang.Object o)
Compares this text to another object.

Specified by:
compareTo in interface java.lang.Comparable

compareToIgnoreCase

public int compareToIgnoreCase(Text t)
Compares this text to another object, ignoring case considerations.


charAt

public char charAt(int index)
Returns the character at the specified index.

Specified by:
charAt in interface java.lang.CharSequence

length

public int length()
Returns the length of this text.

Specified by:
length in interface java.lang.CharSequence

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Returns a new character sequence that is a subsequence of this text.

Specified by:
subSequence in interface java.lang.CharSequence

toString

public java.lang.String toString()
Returns a string containing the characters in this text.

Specified by:
toString in interface java.lang.CharSequence

equals

public boolean equals(java.lang.Object o)
Compares this text to the specified object.


equalsIgnoreCase

public boolean equalsIgnoreCase(Text t)
Compares this text to the specified object, ignoring case considerations.


hashCode

public int hashCode()
Returns a hash code for this string.