All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class asjava.uniclientlibs.UniString

java.lang.Object
   |
   +----asjava.uniclientlibs.UniString

public class UniString
extends Object
implements Serializable
UniString is the primary class used for handling UniObjects Java string operations. It is an extension of the general String and StringBuffer classes, with numerous UniVerse specific additions. Unlike those classes, however, operations performed on the object, such as insert, change the internal data element and do not return a new object.

Version:
Version 1.0
Author:
David T. Meeks

Variable Index

 o count
 o inPacket
 o internalMarkArray
 o outPacket
 o uniConnection
 o uniReturnCode
 o uniStatus
 o value

Constructor Index

 o UniString()
Constructs a UniString with no characters in it and an initial capacity of 16 characters.
 o UniString(int)
Constructs a UniString with no characters in it and an initial capacity specified by the length argument.
 o UniString(Object)
Constructs a UniString with the value set to the supplied argument
 o UniString(String)
Constructs a UniString with the value set to the supplied argument
 o UniString(UniConnection)
Constructs a UniString with no characters in it and an initial capacity of 16 characters, binds it to the given UniConnection object which will cause it to perform certain operations on the server
 o UniString(UniConnection, Object)
Constructs a UniString with no characters in it and an initial capacity of 16 characters.

Method Index

 o alpha()
Determines whether a given session contains only alphabetic characters
 o alpha(UniConnection)
Determines whether a given session contains only alphabetic characters.
 o append(boolean)
Appends the string representation of the boolean argument to the string buffer.
 o append(char)
Appends the string representation of the char argument to this string buffer.
 o append(char[])
Appends the string representation of the char array argument to this string buffer.
 o append(char[], int, int)
Appends the string representation of a subarray of the char array argument to this string buffer.
 o append(double)
Appends the string representation of the double argument to this string buffer.
 o append(float)
Appends the string representation of the float argument to this string buffer.
 o append(int)
Appends the string representation of the int argument to this string buffer.
 o append(long)
Appends the string representation of the long argument to this string buffer.
 o append(Object)
Appends the string representation of the Object argument to this string buffer.
 o append(String)
Appends the string representation of the Object argument to this string buffer.
 o change(Object, Object)
Changes the current string by replacing a given substring expression with the replacement substring specified
 o change(Object, Object, int)
Changes the current string by replacing a given substring expression with the replacement substring specified
 o change(Object, Object, int, int)
Changes the current string by replacing a given substring expression with the replacement substring specified
 o charAt(int)
Returns the character at a specific index in this string buffer.
 o compareTo(Object)
Returns the lexicographical comparison of this string against the string passed in as an argument.
 o convert(Object, Object)
Converts a set of characters with a new set
 o convert(UniConnection, Object, Object)
Converts a set of characters with a new set
 o count()
Count the number of
 o count(Object)
Count the number of occurances of the given substring
 o dcount()
Count the number of occurances of the
 o dcount(Object)
Count the number of occurances of the given substring, adding one to it
 o equals(Object)
Determine whether this UniString is equivalent to another Object.
 o equalsIgnoreCase(Object)
Determine whether this UniString is equivalent to another Object, when case is ignored.
 o getBytes()
return the current string as a byte[] array
 o getChars(int, int, char[], int)
Characters are copied from this string buffer into the destination character array dst.
 o getMarkCharacter(int)
Returns the requested mark character.
 o iconv(UniConnection, Object)
Performs a conversion of the current string into an internal representation, which depends on the given conversion code
 o insert(int, boolean)
Inserts the string representation of the boolean argument into this string buffer.
 o insert(int, char)
Inserts the string representation of the char argument into this string buffer.
 o insert(int, char[])
Inserts the string representation of the char array argument into this string buffer.
 o insert(int, double)
Inserts the string representation of the double argument into this string buffer.
 o insert(int, float)
Inserts the string representation of the float argument into this string buffer.
 o insert(int, int)
Inserts the string representation of the second int argument into this string buffer.
 o insert(int, long)
Inserts the string representation of the long argument into this string buffer.
 o insert(int, Object)
Inserts the string into this string buffer.
 o left(int)
Returns the leftmost aNumChars characters of the string.
 o length()
Returns the length (character count) of this string buffer.
 o oconv(UniConnection, Object)
Performs a conversion of the current string into an external representation, which depends on the given conversion code
 o quote()
Quotes the given string with the "'" character (single quote)
 o quote(Object)
Quotes the given string with the given quote character
 o right(int)
Returns the rightmost aNumChars characters of the string.
 o setCharAt(int, char)
The character at the specified index of this string buffer is set to ch.
 o setValue(Object)
Sets the current values of the string buffer and it's size
 o setValue(String)
Sets the current values of the string buffer and it's size
 o status()
Returns the current status of the last operation
 o substring(int)
return a substring of the current UniString, starting at the given index
 o substring(int, int)
return a substring of the current UniString, starting at the given index and ending at the given endpoint
 o toCharArray()
return the current string as a char[] array
 o toLowerCase()
change the given string to all lower case characters
 o toString()
Converts to a string representing the data in this string buffer.
 o toUpperCase()
change the given string to all upper case characters

Variables

 o internalMarkArray
 protected String internalMarkArray[]
 o value
 protected char value[]
 o count
 protected int count
 o uniStatus
 protected int uniStatus
 o uniReturnCode
 protected int uniReturnCode
 o uniConnection
 protected UniConnection uniConnection
 o inPacket
 protected UniRPCPacket inPacket
 o outPacket
 protected UniRPCPacket outPacket

Constructors

 o UniString
 public UniString()
Constructs a UniString with no characters in it and an initial capacity of 16 characters.

 o UniString
 public UniString(int length)
Constructs a UniString with no characters in it and an initial capacity specified by the length argument.

Parameters:
length - the initial capacity.
 o UniString
 public UniString(String aString)
Constructs a UniString with the value set to the supplied argument

Parameters:
aString - initial string to set the object to
 o UniString
 public UniString(Object aString)
Constructs a UniString with the value set to the supplied argument

Parameters:
aString - initial string to set the object to
 o UniString
 public UniString(UniConnection aNewSession)
Constructs a UniString with no characters in it and an initial capacity of 16 characters, binds it to the given UniConnection object which will cause it to perform certain operations on the server

Parameters:
aNewSession - UniConnection object to bind the string to
 o UniString
 public UniString(UniConnection aNewSession,
                  Object aString)
Constructs a UniString with no characters in it and an initial capacity of 16 characters.

Parameters:
aNewSession - UniConnection object to bind the string to
aString - initial string to set the object to.

Methods

 o alpha
 public boolean alpha() throws UniStringException
Determines whether a given session contains only alphabetic characters

Returns:
boolean to indicate whether string is all alphabetic or not
Throws: UniStringException
is thrown if an error occurs
 o alpha
 public boolean alpha(UniConnection aConnection) throws UniStringException
Determines whether a given session contains only alphabetic characters. This version uses the defined UniConnection reference to perform the operation on the defined connection. This is primarily done for NLS purposes.

Parameters:
aConnection - UniConnection object representing the server we should contact to ensure this string is alphabetic
Returns:
boolean to indicate whether string is all alphabetic or not
Throws: UniStringException
is thrown if an error occurs
 o append
 public synchronized void append(String aString)
Appends the string representation of the Object argument to this string buffer.

Parameters:
aString - string to append
 o append
 public synchronized void append(Object aString)
Appends the string representation of the Object argument to this string buffer.

Parameters:
aString - string to append
 o append
 public synchronized void append(char str[])
Appends the string representation of the char array argument to this string buffer.

Parameters:
str - the characters to be appended.
 o append
 public synchronized void append(char str[],
                                 int offset,
                                 int len)
Appends the string representation of a subarray of the char array argument to this string buffer.

Parameters:
str - the characters to be appended.
offset - the index of the first character to append.
len - the number of characters to append.
 o append
 public synchronized void append(boolean b)
Appends the string representation of the boolean argument to the string buffer.

Parameters:
b - a boolean.
 o append
 public synchronized void append(char c)
Appends the string representation of the char argument to this string buffer.

Parameters:
ch - a char.
 o append
 public synchronized void append(int i)
Appends the string representation of the int argument to this string buffer.

Parameters:
i - an int.
 o append
 public synchronized void append(long l)
Appends the string representation of the long argument to this string buffer.

Parameters:
l - a long.
 o append
 public synchronized void append(float f)
Appends the string representation of the float argument to this string buffer.

Parameters:
f - a float.
 o append
 public synchronized void append(double d)
Appends the string representation of the double argument to this string buffer.

Parameters:
d - a double.
 o change
 public void change(Object aSubString,
                    Object aReplacementString)
Changes the current string by replacing a given substring expression with the replacement substring specified

Parameters:
aSubString - String representing the substring to be replaced
aReplacementString - String representing what the aSubString should be replaced with
 o change
 public void change(Object aSubString,
                    Object aReplacementString,
                    int aOccurance)
Changes the current string by replacing a given substring expression with the replacement substring specified

Parameters:
aSubString - String representing the substring to be replaced
aReplacementString - String representing what the aSubString should be replaced with
aOccurance - integer representing the number of occurance to change. A number less than 1 refers to replacing all occurrances of the substring
 o change
 public void change(Object aSubString,
                    Object aReplacementString,
                    int aOccurance,
                    int aStart)
Changes the current string by replacing a given substring expression with the replacement substring specified

Parameters:
aSubString - String representing the substring to be replaced
aReplacementString - String representing what the aSubString should be replaced with
aOccurance - integer representing the number of occurance to change. A number less than 1 refers to replacing all occurrances of the substring
aStart - integer referring to the first occurance to start replacing. A number less than 1 refers to starting from the beginning
 o charAt
 public synchronized char charAt(int index) throws UniStringException
Returns the character at a specific index in this string buffer.

Parameters:
index - the index of the desired character.
Returns:
the character at the specified index of this string buffer.
Throws: UniStringException
is thrown if an error occurs
 o compareTo
 public int compareTo(Object aCompareString)
Returns the lexicographical comparison of this string against the string passed in as an argument. Will return a 0 if the strings are lexicographically equivalent, a value less than 0 if this string is less than the argument string, or a value greater than 0 if this string is lexicographically greater.

Parameters:
aCompareString - Object to compare against
Returns:
integer representing the lexicographical comparison. 0 denotes equivalence, < 0 denotes this string is less than the argument string, and > 0 denotes that it compares greater than the argument string.
 o convert
 public void convert(UniConnection aConnection,
                     Object aReplaceChars,
                     Object aReplaceWithChars) throws UniStringException
Converts a set of characters with a new set

Parameters:
aConnection - UniConnection object used to establish which server to perform operation
aReplaceChars - String of characters to be replaced
aReplaceWithChars - characters to replace the others with.
Throws: UniStringException
is thrown if an error occurs
 o convert
 public void convert(Object aReplaceChars,
                     Object aReplaceWithChars) throws UniStringException
Converts a set of characters with a new set

Parameters:
aReplaceChars - String of characters to be replaced
aReplaceWithChars - characters to replace the others with.
Throws: UniStringException
is thrown if an error occurs
 o count
 public int count()
Count the number of @FM marks existing in the string

Returns:
integer representing the number of occurances
 o count
 public int count(Object aSubString)
Count the number of occurances of the given substring

Parameters:
aSubString - String representing the substring to check for
Returns:
integer representing the number of occurances
 o dcount
 public int dcount()
Count the number of occurances of the @FM mark character, adding one to it

Returns:
integer representing the number of occurances
 o dcount
 public int dcount(Object aSubString)
Count the number of occurances of the given substring, adding one to it

Parameters:
aSubString - String representing the substring to check for
Returns:
integer representing the number of occurances
 o equals
 public boolean equals(Object aCompareString)
Determine whether this UniString is equivalent to another Object. Will return true only if the two objects represent the same sequence of characters.

Parameters:
aCompareString - Object to compare against
Returns:
boolean representing true if the sequence of characters represented by both is equivalent
Overrides:
equals in class Object
 o equalsIgnoreCase
 public boolean equalsIgnoreCase(Object aCompareString)
Determine whether this UniString is equivalent to another Object, when case is ignored. Will return true only if the two objects represent the same sequence of characters.

Parameters:
aCompareString - Object to compare against
Returns:
boolean representing true if the sequence of characters represented by both is equivalent
 o getBytes
 public byte[] getBytes()
return the current string as a byte[] array

Returns:
byte[] representing the current string
 o getChars
 public synchronized void getChars(int srcBegin,
                                   int srcEnd,
                                   char dst[],
                                   int dstBegin) throws UniStringException
Characters are copied from this string buffer into the destination character array dst. The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1. The total number of characters to be copied is srcEnd-srcBegin. The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

     dstbegin + (srcEnd-srcBegin) - 1
 

Parameters:
srcBegin - start copying at this offset in the string buffer.
srcEnd - stop copying at this offset in the string buffer.
dst - the array to copy the data into.
dstBegin - offset into dst.
Throws: UniStringException
if there is an invalid index into the buffer.
 o getMarkCharacter
 public String getMarkCharacter(int aTokenVal) throws UniStringException
Returns the requested mark character. Valid input values are:

Returns:
String representing the requested mark value
Throws: UniStringException
is thrown if the input value is invalid
 o iconv
 public UniString iconv(UniConnection aConnection,
                        Object aConvCode) throws UniStringException
Performs a conversion of the current string into an internal representation, which depends on the given conversion code

Parameters:
aConnection - UniConnection object representing which server to use to perform the conversion
aConvCode - String representing the conversion that is to take place
Returns:
UniString new string object representing the new value
Throws: UniStringException
is thrown if an error occurs
 o insert
 public synchronized void insert(int offset,
                                 Object obj)
Inserts the string into this string buffer.

The characters of the String argument are inserted, in order, into this string buffer at the indicated offset. The length of this string buffer is increased by the length of the argument.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
str - a string.
 o insert
 public synchronized void insert(int offset,
                                 char str[])
Inserts the string representation of the char array argument into this string buffer.

The characters of the array argument are inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by the length of the argument.

Parameters:
offset - the offset.
ch - a character array.
 o insert
 public void insert(int offset,
                    boolean b)
Inserts the string representation of the boolean argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
b - a boolean.
 o insert
 public synchronized void insert(int offset,
                                 char c)
Inserts the string representation of the char argument into this string buffer.

The second argument is inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by one.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
ch - a char.
 o insert
 public synchronized void insert(int offset,
                                 int i)
Inserts the string representation of the second int argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
b - an int.
 o insert
 public synchronized void insert(int offset,
                                 long l)
Inserts the string representation of the long argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
b - a long.
 o insert
 public synchronized void insert(int offset,
                                 float f)
Inserts the string representation of the float argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
b - a float.
 o insert
 public synchronized void insert(int offset,
                                 double d)
Inserts the string representation of the double argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Parameters:
offset - the offset.
b - a double.
 o left
 public UniString left(int aNumChars)
Returns the leftmost aNumChars characters of the string.

Parameters:
aNumChars - integer representing the leftmost N characters of the string
Returns:
the requested number of characters from the left handside of the string
 o length
 public int length()
Returns the length (character count) of this string buffer.

Returns:
the number of characters in this string buffer.
 o oconv
 public UniString oconv(UniConnection aConnection,
                        Object aConvCode) throws UniStringException
Performs a conversion of the current string into an external representation, which depends on the given conversion code

Parameters:
aConnection - UniConnection object representing which server to use to perform the conversion
aConvCode - String representing the conversion that is to take place
Returns:
UniString new string object representing the new value
Throws: UniStringException
is thrown if an error occurs
 o quote
 public void quote()
Quotes the given string with the "'" character (single quote)

 o quote
 public void quote(Object aChar)
Quotes the given string with the given quote character

Parameters:
aChar - character to quote string with
 o right
 public UniString right(int aNumChars)
Returns the rightmost aNumChars characters of the string.

Parameters:
aNumChars - integer representing the rightmost N characters of the string
Returns:
the requested number of characters from the rightmost handside of the string
 o setCharAt
 public synchronized void setCharAt(int index,
                                    char ch) throws UniStringException
The character at the specified index of this string buffer is set to ch.

The offset argument must be greater than or equal to 0, and less than the length of this string buffer.

Parameters:
index - the index of the character to modify.
ch - the new character.
Throws: UniStringException
if the index is invalid.
 o setValue
 public void setValue(String newValue)
Sets the current values of the string buffer and it's size

Returns:
current status value
 o setValue
 public void setValue(Object newValue)
Sets the current values of the string buffer and it's size

Returns:
current status value
 o status
 public int status()
Returns the current status of the last operation

Returns:
current status value
 o substring
 public UniString substring(int aBeginIndex) throws UniStringException
return a substring of the current UniString, starting at the given index

Parameters:
int - aBeginIndex beginning index to take the substring from
Returns:
UniString representing the substring requested
Throws: UniStringException
is thrown if an error occurs
 o substring
 public UniString substring(int aBeginPoint,
                            int aEndPoint) throws UniStringException
return a substring of the current UniString, starting at the given index and ending at the given endpoint

Parameters:
aBeginPoint - beginning index to take the substring from
aEndPoint - where to end the substring operation
Returns:
UniString representing the substring requested
Throws: UniStringException
is thrown if an error occurs
 o toCharArray
 public char[] toCharArray()
return the current string as a char[] array

Returns:
char[] representing the current string
 o toLowerCase
 public UniString toLowerCase()
change the given string to all lower case characters

Returns:
UniString representing the current string in all lower case
 o toUpperCase
 public UniString toUpperCase()
change the given string to all upper case characters

Returns:
UniString representing the current string in all upper case
 o toString
 public String toString()
Converts to a string representing the data in this string buffer. A new String object is allocated and initialized to contain the character sequence currently represented by this string buffer. This String is then returned. Subsequent changes to the string buffer do not affect the contents of the String.

Returns:
a string representation of the string buffer.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index