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
-
count
-
-
inPacket
-
-
internalMarkArray
-
-
outPacket
-
-
uniConnection
-
-
uniReturnCode
-
-
uniStatus
-
-
value
-
-
UniString()
- Constructs a UniString with no characters in it and an
initial capacity of 16 characters.
-
UniString(int)
- Constructs a UniString with no characters in it and an
initial capacity specified by the
length
argument.
-
UniString(Object)
- Constructs a UniString with the value set to the supplied argument
-
UniString(String)
- Constructs a UniString with the value set to the supplied argument
-
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
-
UniString(UniConnection, Object)
- Constructs a UniString with no characters in it and an
initial capacity of 16 characters.
-
alpha()
- Determines whether a given session contains only alphabetic characters
-
alpha(UniConnection)
- Determines whether a given session contains only alphabetic characters.
-
append(boolean)
- Appends the string representation of the
boolean
argument to the string buffer.
-
append(char)
- Appends the string representation of the
char
argument to this string buffer.
-
append(char[])
- Appends the string representation of the
char
array
argument to this string buffer.
-
append(char[], int, int)
- Appends the string representation of a subarray of the
char
array argument to this string buffer.
-
append(double)
- Appends the string representation of the
double
argument to this string buffer.
-
append(float)
- Appends the string representation of the
float
argument to this string buffer.
-
append(int)
- Appends the string representation of the
int
argument to this string buffer.
-
append(long)
- Appends the string representation of the
long
argument to this string buffer.
-
append(Object)
- Appends the string representation of the
Object
argument to this string buffer.
-
append(String)
- Appends the string representation of the
Object
argument to this string buffer.
-
change(Object, Object)
- Changes the current string by replacing a given substring expression
with the replacement substring specified
-
change(Object, Object, int)
- Changes the current string by replacing a given substring expression
with the replacement substring specified
-
change(Object, Object, int, int)
- Changes the current string by replacing a given substring expression
with the replacement substring specified
-
charAt(int)
- Returns the character at a specific index in this string buffer.
-
compareTo(Object)
- Returns the lexicographical comparison of this string against the string
passed in as an argument.
-
convert(Object, Object)
- Converts a set of characters with a new set
-
convert(UniConnection, Object, Object)
- Converts a set of characters with a new set
-
count()
- Count the number of
-
count(Object)
- Count the number of occurances of the given substring
-
dcount()
- Count the number of occurances of the
-
dcount(Object)
- Count the number of occurances of the given substring, adding one to it
-
equals(Object)
- Determine whether this UniString is equivalent to another Object.
-
equalsIgnoreCase(Object)
- Determine whether this UniString is equivalent to another Object, when case
is ignored.
-
getBytes()
- return the current string as a byte[] array
-
getChars(int, int, char[], int)
- Characters are copied from this string buffer into the
destination character array
dst
.
-
getMarkCharacter(int)
- Returns the requested mark character.
-
iconv(UniConnection, Object)
- Performs a conversion of the current string into an internal
representation, which depends on the given conversion code
-
insert(int, boolean)
- Inserts the string representation of the
boolean
argument into this string buffer.
-
insert(int, char)
- Inserts the string representation of the
char
argument into this string buffer.
-
insert(int, char[])
- Inserts the string representation of the
char
array
argument into this string buffer.
-
insert(int, double)
- Inserts the string representation of the
double
argument into this string buffer.
-
insert(int, float)
- Inserts the string representation of the
float
argument into this string buffer.
-
insert(int, int)
- Inserts the string representation of the second
int
argument into this string buffer.
-
insert(int, long)
- Inserts the string representation of the
long
argument into this string buffer.
-
insert(int, Object)
- Inserts the string into this string buffer.
-
left(int)
- Returns the leftmost
aNumChars
characters of the string.
-
length()
- Returns the length (character count) of this string buffer.
-
oconv(UniConnection, Object)
- Performs a conversion of the current string into an external
representation, which depends on the given conversion code
-
quote()
- Quotes the given string with the "'" character (single quote)
-
quote(Object)
- Quotes the given string with the given quote character
-
right(int)
- Returns the rightmost
aNumChars
characters of the string.
-
setCharAt(int, char)
- The character at the specified index of this string buffer is set
to
ch
.
-
setValue(Object)
- Sets the current values of the string buffer and it's size
-
setValue(String)
- Sets the current values of the string buffer and it's size
-
status()
- Returns the current status of the last operation
-
substring(int)
- return a substring of the current UniString, starting at the given index
-
substring(int, int)
- return a substring of the current UniString, starting at the given index
and ending at the given endpoint
-
toCharArray()
- return the current string as a char[] array
-
toLowerCase()
- change the given string to all lower case characters
-
toString()
- Converts to a string representing the data in this string buffer.
-
toUpperCase()
- change the given string to all upper case characters
internalMarkArray
protected String internalMarkArray[]
value
protected char value[]
count
protected int count
uniStatus
protected int uniStatus
uniReturnCode
protected int uniReturnCode
uniConnection
protected UniConnection uniConnection
inPacket
protected UniRPCPacket inPacket
outPacket
protected UniRPCPacket outPacket
UniString
public UniString()
- Constructs a UniString with no characters in it and an
initial capacity of 16 characters.
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.
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
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
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
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.
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
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
append
public synchronized void append(String aString)
- Appends the string representation of the
Object
argument to this string buffer.
- Parameters:
- aString - string to append
append
public synchronized void append(Object aString)
- Appends the string representation of the
Object
argument to this string buffer.
- Parameters:
- aString - string to append
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.
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.
append
public synchronized void append(boolean b)
- Appends the string representation of the
boolean
argument to the string buffer.
- Parameters:
- b - a
boolean
.
append
public synchronized void append(char c)
- Appends the string representation of the
char
argument to this string buffer.
- Parameters:
- ch - a
char
.
append
public synchronized void append(int i)
- Appends the string representation of the
int
argument to this string buffer.
- Parameters:
- i - an
int
.
append
public synchronized void append(long l)
- Appends the string representation of the
long
argument to this string buffer.
- Parameters:
- l - a
long
.
append
public synchronized void append(float f)
- Appends the string representation of the
float
argument to this string buffer.
- Parameters:
- f - a
float
.
append
public synchronized void append(double d)
- Appends the string representation of the
double
argument to this string buffer.
- Parameters:
- d - a
double
.
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
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
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
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
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.
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
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
count
public int count()
- Count the number of @FM marks existing in the string
- Returns:
- integer representing the number of occurances
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
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
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
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
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
getBytes
public byte[] getBytes()
- return the current string as a byte[] array
- Returns:
- byte[] representing the current string
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.
getMarkCharacter
public String getMarkCharacter(int aTokenVal) throws UniStringException
- Returns the requested mark character. Valid input values are:
- UniTokens.IM (0) - Item Mark
- UniTokens.FM (1) - Field Mark
- UniTokens.VM (2) - Value Mark
- UniTokens.SVM(3) - SubValue Mark
- UniTokens.TM (4) - Text Mark
- Returns:
- String representing the requested mark value
- Throws: UniStringException
- is thrown if the input value is invalid
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
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.
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.
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
.
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
.
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
.
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
.
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
.
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
.
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
length
public int length()
- Returns the length (character count) of this string buffer.
- Returns:
- the number of characters in this string buffer.
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
quote
public void quote()
- Quotes the given string with the "'" character (single quote)
quote
public void quote(Object aChar)
- Quotes the given string with the given quote character
- Parameters:
- aChar - character to quote string with
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
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.
setValue
public void setValue(String newValue)
- Sets the current values of the string buffer and it's size
- Returns:
- current status value
setValue
public void setValue(Object newValue)
- Sets the current values of the string buffer and it's size
- Returns:
- current status value
status
public int status()
- Returns the current status of the last operation
- Returns:
- current status value
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
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
toCharArray
public char[] toCharArray()
- return the current string as a char[] array
- Returns:
- char[] representing the current string
toLowerCase
public UniString toLowerCase()
- change the given string to all lower case characters
- Returns:
- UniString representing the current string in all lower case
toUpperCase
public UniString toUpperCase()
- change the given string to all upper case characters
- Returns:
- UniString representing the current string in all upper case
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