Quadcap Embeddable Database

com.quadcap.util.OctetString Class Reference

List of all members.

Detailed Description

An OctetString is a variable length string of octets.

Author:
Stan Bailes

Definition at line 51 of file OctetString.java.

Public Member Functions

 OctetString (byte[] data)
 Construct a new OctetString using the specified byte array.

 OctetString (byte[] data, int offset, int len)
 Construct a new OctetString using a substring from the specified byte array.

 OctetString (String str)
 Construct a new OctetString from the specified java.lang.String value.

String toString ()
 Return the string representation of this item.

byte[] getBytes ()
 For types which can be directly handled by comparators, return this object as a byte array.

int hashCode ()
boolean equals (Object obj)
boolean equalsIgnoreCase (Object obj)
int size ()
 Return the size of this string.

int indexOf (char c)
 String search for character.

int lastIndexOf (char c)
 String search for character.

OctetString substring (int start, int end)
 Return a new string containing the specified substring of this string.

OctetString substring (int start)
 Return a new string containing the specified substring of this string, starting with the specified character, and ending with the last character of the string.

OctetString afterLast (char c)
 A truly general purpose function designed for a specified task, this returns a new string containing the portion of this string after the last occurrence of the specified character.

OctetString before (char c)
 Return substring containing the portion of this string before the first occurence of the specified character.

OctetString beforeLast (char c)
 A truly general purpose function designed for a specified task, this returns a new string containing the portion of this string before the last occurrence of the specified character.

int getIntSubString (int start, int end)
 Another general purpose routine :-) This one converts a particular substring of this string to an integer.

OctetString append (String s)
 String concatenation.

OctetString append (OctetString s)
 String concatenation.

OctetString append (byte[] b)
 String concatenation.


Static Public Member Functions

boolean equals (OctetString s1, int pos1, OctetString s2, int pos2, int len)
 String comparison using the binary equality comparator.


Package Attributes

byte[] data


Constructor & Destructor Documentation

com.quadcap.util.OctetString.OctetString byte[]  data  ) 
 

Construct a new OctetString using the specified byte array.

Note that we simply acquire the byte array -- no copying is done!

Parameters:
data the byte array making up the string

Definition at line 60 of file OctetString.java.

com.quadcap.util.OctetString.OctetString byte[]  data,
int  offset,
int  len
 

Construct a new OctetString using a substring from the specified byte array.

This constructor does allocate a new byte array and copies data from the original array.

Parameters:
data the source byte array
offset the position of the first character in the substring
len the number of bytes in the new string

Definition at line 73 of file OctetString.java.

com.quadcap.util.OctetString.OctetString String  str  ) 
 

Construct a new OctetString from the specified java.lang.String value.

Parameters:
str the string value

Definition at line 83 of file OctetString.java.


Member Function Documentation

OctetString com.quadcap.util.OctetString.afterLast char  c  ) 
 

A truly general purpose function designed for a specified task, this returns a new string containing the portion of this string after the last occurrence of the specified character.

For example:<PRE> "/addressbook/user/stan/ABC457".afterLast('/') returns "ABC457"

Parameters:
c the character
Returns:
a new OctetString containing the required suffix

Definition at line 200 of file OctetString.java.

References com.quadcap.util.OctetString.afterLast(), and com.quadcap.util.OctetString.data.

Referenced by com.quadcap.util.OctetString.afterLast().

OctetString com.quadcap.util.OctetString.append byte[]  b  ) 
 

String concatenation.

Definition at line 275 of file OctetString.java.

References com.quadcap.util.OctetString.data.

OctetString com.quadcap.util.OctetString.append OctetString  s  ) 
 

String concatenation.

Definition at line 268 of file OctetString.java.

References com.quadcap.util.OctetString.data.

OctetString com.quadcap.util.OctetString.append String  s  ) 
 

String concatenation.

Definition at line 261 of file OctetString.java.

References com.quadcap.util.OctetString.append().

Referenced by com.quadcap.util.OctetString.append().

OctetString com.quadcap.util.OctetString.before char  c  ) 
 

Return substring containing the portion of this string before the first occurence of the specified character.

Parameters:
c the character
Returns:
a new OctetString containing the substring.

Definition at line 215 of file OctetString.java.

References com.quadcap.util.OctetString.before().

Referenced by com.quadcap.util.OctetString.before().

OctetString com.quadcap.util.OctetString.beforeLast char  c  ) 
 

A truly general purpose function designed for a specified task, this returns a new string containing the portion of this string before the last occurrence of the specified character.

For example:<PRE> "/addressbook/user/stan/ABC457".beforeLast('/') returns "/addressbook/user/stan"

Parameters:
c the character
Returns:
a new OctetString containing the required prefix

Definition at line 234 of file OctetString.java.

References com.quadcap.util.OctetString.beforeLast(), and com.quadcap.util.OctetString.data.

Referenced by com.quadcap.util.OctetString.beforeLast().

boolean com.quadcap.util.OctetString.equals OctetString  s1,
int  pos1,
OctetString  s2,
int  pos2,
int  len
[static]
 

String comparison using the binary equality comparator.

Definition at line 128 of file OctetString.java.

References com.quadcap.util.OctetString.data.

boolean com.quadcap.util.OctetString.equals Object  obj  ) 
 

Definition at line 105 of file OctetString.java.

References com.quadcap.util.OctetString.equals().

Referenced by com.quadcap.util.OctetString.equals().

boolean com.quadcap.util.OctetString.equalsIgnoreCase Object  obj  ) 
 

Definition at line 112 of file OctetString.java.

References com.quadcap.util.OctetString.equalsIgnoreCase().

Referenced by com.quadcap.util.OctetString.equalsIgnoreCase().

byte [] com.quadcap.util.OctetString.getBytes  ) 
 

For types which can be directly handled by comparators, return this object as a byte array.

For special types (e.g., NIL or List), return null.

Definition at line 99 of file OctetString.java.

References com.quadcap.util.OctetString.data.

Referenced by com.quadcap.util.OctetComparator.getBytes().

int com.quadcap.util.OctetString.getIntSubString int  start,
int  end
 

Another general purpose routine :-) This one converts a particular substring of this string to an integer.

Parameters:
start the position of the first character of the substring
end the position of the character after the substring

Definition at line 249 of file OctetString.java.

References com.quadcap.util.OctetString.data, and com.quadcap.util.OctetString.getIntSubString().

Referenced by com.quadcap.util.OctetString.getIntSubString().

int com.quadcap.util.OctetString.hashCode  ) 
 

Definition at line 101 of file OctetString.java.

References com.quadcap.util.OctetString.data.

int com.quadcap.util.OctetString.indexOf char  c  ) 
 

String search for character.

Should this use a comparator? XXX

Parameters:
c the character to search for
Returns:
the index of the first occurrence of the character in this string, or -1 if the character does not occur in the string.

Definition at line 145 of file OctetString.java.

References com.quadcap.util.OctetString.data, and com.quadcap.util.OctetString.indexOf().

Referenced by com.quadcap.util.OctetString.indexOf().

int com.quadcap.util.OctetString.lastIndexOf char  c  ) 
 

String search for character.

Should this use a comparator? XXX

Parameters:
c the character to search for
Returns:
the index of the last occurrence of the character in this string, or -1 if the character does not occur in the string.

Definition at line 158 of file OctetString.java.

References com.quadcap.util.OctetString.data, and com.quadcap.util.OctetString.lastIndexOf().

Referenced by com.quadcap.util.OctetString.lastIndexOf().

int com.quadcap.util.OctetString.size  ) 
 

Return the size of this string.

Definition at line 123 of file OctetString.java.

References com.quadcap.util.OctetString.data.

Referenced by com.quadcap.util.OctetString.substring().

OctetString com.quadcap.util.OctetString.substring int  start  ) 
 

Return a new string containing the specified substring of this string, starting with the specified character, and ending with the last character of the string.

Parameters:
start the position of the first character of the substring
Returns:
the substring

Definition at line 183 of file OctetString.java.

References com.quadcap.util.OctetString.size().

OctetString com.quadcap.util.OctetString.substring int  start,
int  end
 

Return a new string containing the specified substring of this string.

Parameters:
start the position of the first character of the substring
end the position of the character after the substring
Returns:
the substring

Definition at line 171 of file OctetString.java.

References com.quadcap.util.OctetString.data, and com.quadcap.util.OctetString.substring().

Referenced by com.quadcap.util.OctetString.substring().

String com.quadcap.util.OctetString.toString  ) 
 

Return the string representation of this item.

Returns:
the string value

Definition at line 92 of file OctetString.java.

References com.quadcap.util.OctetString.data.


Member Data Documentation

byte [] com.quadcap.util.OctetString.data [package]
 

Definition at line 52 of file OctetString.java.

Referenced by com.quadcap.util.OctetString.afterLast(), com.quadcap.util.OctetString.append(), com.quadcap.util.OctetString.beforeLast(), com.quadcap.util.OctetString.equals(), com.quadcap.util.OctetString.getBytes(), com.quadcap.util.OctetString.getIntSubString(), com.quadcap.util.OctetString.hashCode(), com.quadcap.util.OctetString.indexOf(), com.quadcap.util.OctetString.lastIndexOf(), com.quadcap.util.OctetString.size(), com.quadcap.util.OctetString.substring(), and com.quadcap.util.OctetString.toString().