|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectasjava.uniclientlibs.UniString
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.
Field Summary | |
---|---|
protected int |
count
|
protected asjava.unirpc.UniRPCPacket |
inPacket
|
protected asjava.unirpc.UniRPCPacket |
outPacket
|
protected UniConnection |
uniConnection
|
protected int |
uniReturnCode
|
protected int |
uniStatus
|
protected char[] |
value
|
Constructor Summary | |
---|---|
UniString()
Constructs a UniString with no characters in it and an initial capacity of 16 characters. |
|
UniString(int length)
Constructs a UniString with no characters in it and an initial capacity specified by the length argument. |
|
UniString(java.lang.Object aString)
Constructs a UniString with the value set to the supplied argument |
|
UniString(java.lang.String aString)
Constructs a UniString with the value set to the supplied argument |
|
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 |
|
UniString(UniConnection aNewSession,
java.lang.Object aString)
Constructs a UniString with no characters in it and an initial capacity of 16 characters. |
|
UniString(UniString aString)
Constructs a UniString (copy constructor) |
Method Summary | |
---|---|
boolean |
alpha()
Determines whether a given session contains only alphabetic characters |
boolean |
alpha(UniConnection aConnection)
Determines whether a given session contains only alphabetic characters. |
void |
append(boolean b)
Appends the string representation of the boolean
argument to the string buffer. |
void |
append(char c)
Appends the string representation of the char
argument to this string buffer. |
void |
append(char[] str)
Appends the string representation of the char array
argument to this string buffer. |
void |
append(char[] str,
int offset,
int len)
Appends the string representation of a subarray of the char array argument to this string buffer. |
void |
append(double d)
Appends the string representation of the double
argument to this string buffer. |
void |
append(float f)
Appends the string representation of the float
argument to this string buffer. |
void |
append(int i)
Appends the string representation of the int
argument to this string buffer. |
void |
append(long l)
Appends the string representation of the long
argument to this string buffer. |
void |
append(java.lang.Object aString)
Appends the string representation of the Object
argument to this string buffer. |
void |
append(java.lang.String aString)
Appends the string representation of the Object
argument to this string buffer. |
void |
change(java.lang.Object aSubString,
java.lang.Object aReplacementString)
Changes the current string by replacing a given substring expression with the replacement substring specified |
void |
change(java.lang.Object aSubString,
java.lang.Object aReplacementString,
int aOccurance)
Changes the current string by replacing a given substring expression with the replacement substring specified |
void |
change(java.lang.Object aSubString,
java.lang.Object aReplacementString,
int aOccurance,
int aStart)
Changes the current string by replacing a given substring expression with the replacement substring specified |
char |
charAt(int index)
Returns the character at a specific index in this string buffer. |
int |
compareTo(java.lang.Object aCompareString)
Returns the lexicographical comparison of this string against the string passed in as an argument. |
void |
convert(java.lang.Object aReplaceChars,
java.lang.Object aReplaceWithChars)
Converts a set of characters with a new set |
void |
convert(UniConnection aConnection,
java.lang.Object aReplaceChars,
java.lang.Object aReplaceWithChars)
Converts a set of characters with a new set |
int |
count()
Count the number of @FM marks existing in the string |
int |
count(java.lang.Object aSubString)
Count the number of occurances of the given substring |
int |
dcount()
Count the number of occurances of the @FM mark character, adding one to it |
int |
dcount(java.lang.Object aSubString)
Count the number of occurances of the given substring, adding one to it |
boolean |
equals(java.lang.Object anObject)
Determine whether this UniString is equivalent to another Object. |
boolean |
equalsIgnoreCase(java.lang.Object anObject)
Determine whether this UniString is equivalent to another Object, when case is ignored. |
byte[] |
getBytes()
return the current string as a byte[] array |
byte[] |
getBytes(java.lang.String enc)
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Characters are copied from this string buffer into the destination character array dst . |
protected java.lang.String |
getInternalMarkCharacter(int aTokenVal)
Returns the requested mark character. |
java.lang.String |
getMarkCharacter(int aTokenVal)
Returns the requested mark character. |
UniString |
iconv(UniConnection aConnection,
java.lang.Object aConvCode)
Performs a conversion of the current string into an internal representation, which depends on the given conversion code |
void |
insert(int offset,
boolean b)
Inserts the string representation of the boolean
argument into this string buffer. |
void |
insert(int offset,
char c)
Inserts the string representation of the char
argument into this string buffer. |
void |
insert(int offset,
char[] str)
Inserts the string representation of the char array
argument into this string buffer. |
void |
insert(int offset,
double d)
Inserts the string representation of the double
argument into this string buffer. |
void |
insert(int offset,
float f)
Inserts the string representation of the float
argument into this string buffer. |
void |
insert(int offset,
int i)
Inserts the string representation of the second int
argument into this string buffer. |
void |
insert(int offset,
long l)
Inserts the string representation of the long
argument into this string buffer. |
void |
insert(int offset,
java.lang.Object obj)
Inserts the string into this string buffer. |
UniString |
left(int aNumChars)
Returns the leftmost aNumChars characters of the string. |
int |
length()
Returns the length (character count) of this string buffer. |
UniString |
oconv(UniConnection aConnection,
java.lang.Object aConvCode)
Performs a conversion of the current string into an external representation, which depends on the given conversion code |
void |
quote()
Quotes the given string with the "'" character (single quote) |
void |
quote(java.lang.Object aChar)
Quotes the given string with the given quote character |
UniString |
right(int aNumChars)
Returns the rightmost aNumChars characters of the string. |
void |
setCharAt(int index,
char ch)
The character at the specified index of this string buffer is set to ch . |
void |
setValue(java.lang.Object newValue)
Sets the current values of the string buffer and it's size |
void |
setValue(java.lang.String newValue)
Sets the current values of the string buffer and it's size |
int |
status()
Returns the current status of the last operation |
UniString |
substring(int aBeginIndex)
return a substring of the current UniString, starting at the given index |
UniString |
substring(int aBeginPoint,
int aEndPoint)
return a substring of the current UniString, starting at the given index and ending at the given endpoint |
char[] |
toCharArray()
return the current string as a char[] array |
UniString |
toLowerCase()
change the given string to all lower case characters |
java.lang.String |
toString()
Converts to a string representing the data in this string buffer. |
UniString |
toUpperCase()
change the given string to all upper case characters |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected char[] value
protected int count
protected int uniStatus
protected int uniReturnCode
protected UniConnection uniConnection
protected asjava.unirpc.UniRPCPacket inPacket
protected asjava.unirpc.UniRPCPacket outPacket
Constructor Detail |
public UniString()
public UniString(int length)
length
argument.
length
- the initial capacity.public UniString(java.lang.String aString)
aString
- initial string to set the object topublic UniString(UniString aString)
aString
- initial string to set the object topublic UniString(java.lang.Object aString)
aString
- initial string to set the object topublic UniString(UniConnection aNewSession)
aNewSession
- UniConnection object to bind the string topublic UniString(UniConnection aNewSession, java.lang.Object aString)
aNewSession
- UniConnection object to bind the string toaString
- initial string to set the object to.Method Detail |
public boolean alpha() throws UniStringException
boolean
to indicate whether string is all alphabetic
or not
UniStringException
- is thrown if an error occurspublic boolean alpha(UniConnection aConnection) throws UniStringException
UniConnection
reference to perform the
operation on the defined connection. This is primarily done for NLS purposes.
aConnection
- UniConnection object representing the server we should contact
to ensure this string is alphabetic
boolean
to indicate whether string is all alphabetic
or not
UniStringException
- is thrown if an error occurspublic void append(java.lang.String aString)
Object
argument to this string buffer.
aString
- string to appendpublic void append(java.lang.Object aString)
Object
argument to this string buffer.
aString
- string to appendpublic void append(char[] str)
char
array
argument to this string buffer.
str
- the characters to be appended.public void append(char[] str, int offset, int len)
char
array argument to this string buffer.
str
- the characters to be appended.offset
- the index of the first character to append.len
- the number of characters to append.public void append(boolean b)
boolean
argument to the string buffer.
b
- a boolean
.public void append(char c)
char
argument to this string buffer.
c
- a char
.public void append(int i)
int
argument to this string buffer.
i
- an int
.public void append(long l)
long
argument to this string buffer.
l
- a long
.public void append(float f)
float
argument to this string buffer.
f
- a float
.public void append(double d)
double
argument to this string buffer.
d
- a double
.public void change(java.lang.Object aSubString, java.lang.Object aReplacementString)
aSubString
- String representing the substring to be replacedaReplacementString
- String representing what the aSubString
should be replaced withpublic void change(java.lang.Object aSubString, java.lang.Object aReplacementString, int aOccurance)
aSubString
- String representing the substring to be replacedaReplacementString
- String representing what the aSubString
should be replaced withaOccurance
- integer representing the number of occurance to change. A number
less than 1 refers to replacing all occurrances of the substringpublic void change(java.lang.Object aSubString, java.lang.Object aReplacementString, int aOccurance, int aStart)
aSubString
- String representing the substring to be replacedaReplacementString
- String representing what the aSubString
should be replaced withaOccurance
- integer representing the number of occurance to change. A number
less than 1 refers to replacing all occurrances of the substringaStart
- integer referring to the first occurance to start replacing. A number
less than 1 refers to starting from the beginningpublic char charAt(int index) throws UniStringException
index
- the index of the desired character.
UniStringException
- is thrown if an error occurspublic int compareTo(java.lang.Object aCompareString)
aCompareString
- Object to compare against
public void convert(UniConnection aConnection, java.lang.Object aReplaceChars, java.lang.Object aReplaceWithChars) throws UniStringException
aConnection
- UniConnection object used to establish which server to perform operationaReplaceChars
- String of characters to be replacedaReplaceWithChars
- characters to replace the others with.
UniStringException
- is thrown if an error occurspublic void convert(java.lang.Object aReplaceChars, java.lang.Object aReplaceWithChars) throws UniStringException
aReplaceChars
- String of characters to be replacedaReplaceWithChars
- characters to replace the others with.
UniStringException
- is thrown if an error occurspublic int count()
public int count(java.lang.Object aSubString)
aSubString
- String representing the substring to check for
public int dcount()
public int dcount(java.lang.Object aSubString)
aSubString
- String representing the substring to check for
public boolean equals(java.lang.Object anObject)
true
only if the two objects represent the same sequence of characters.
anObject
- Object to compare against
true
if the sequence of characters
represented by both is equivalentpublic boolean equalsIgnoreCase(java.lang.Object anObject)
true
only if the two objects represent the same sequence of characters.
anObject
- Object to compare against
true
if the sequence of characters
represented by both is equivalentpublic byte[] getBytes()
public byte[] getBytes(java.lang.String enc) throws java.lang.Exception
java.lang.Exception
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) throws UniStringException
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
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
.
UniStringException
- if there is an invalid index into the buffer.public java.lang.String getMarkCharacter(int aTokenVal) throws UniStringException
UniStringException
- is thrown if the input value is invalidprotected java.lang.String getInternalMarkCharacter(int aTokenVal)
UniStringException
- is thrown if the input value is invalidpublic UniString iconv(UniConnection aConnection, java.lang.Object aConvCode) throws UniStringException
aConnection
- UniConnection object representing which server to
use to perform the conversionaConvCode
- String representing the conversion that is to take place
UniStringException
- is thrown if an error occurspublic void insert(int offset, java.lang.Object obj)
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.
offset
- the offset.obj
- a Object.public void insert(int offset, char[] str)
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.
offset
- the offset.str
- a character array.public void insert(int offset, boolean b)
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.
offset
- the offset.b
- a boolean
.public void insert(int offset, char c)
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.
offset
- the offset.c
- a char
.public void insert(int offset, int i)
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.
offset
- the offset.i
- an int
.public void insert(int offset, long l)
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.
offset
- the offset.l
- a long
.public void insert(int offset, float f)
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.
offset
- the offset.f
- a float
.public void insert(int offset, double d)
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.
offset
- the offset.d
- a double
.public UniString left(int aNumChars)
aNumChars
characters of the string.
aNumChars
- integer representing the leftmost N characters of the string
public int length()
public UniString oconv(UniConnection aConnection, java.lang.Object aConvCode) throws UniStringException
aConnection
- UniConnection object representing which server to
use to perform the conversionaConvCode
- String representing the conversion that is to take place
UniStringException
- is thrown if an error occurspublic void quote()
public void quote(java.lang.Object aChar)
aChar
- character to quote string withpublic UniString right(int aNumChars)
aNumChars
characters of the string.
aNumChars
- integer representing the rightmost N characters of the string
public void setCharAt(int index, char ch) throws UniStringException
ch
.
The offset argument must be greater than or equal to
0
, and less than the length of this string buffer.
index
- the index of the character to modify.ch
- the new character.
UniStringException
- if the index is invalid.public void setValue(java.lang.String newValue)
public void setValue(java.lang.Object newValue)
public int status()
public UniString substring(int aBeginIndex) throws UniStringException
aBeginIndex
- beginning index to take the substring from
UniStringException
- is thrown if an error occurspublic UniString substring(int aBeginPoint, int aEndPoint) throws UniStringException
aBeginPoint
- beginning index to take the substring fromaEndPoint
- where to end the substring operation
UniStringException
- is thrown if an error occurspublic char[] toCharArray()
public UniString toLowerCase()
public UniString toUpperCase()
public java.lang.String toString()
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
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |