Servertec
Jenie
1.0.1 09/04/2005

stec.jenie
Class WideString

java.lang.Object
  extended by stec.jenie.NativeObject
      extended by stec.jenie.WideString

public class WideString
extends NativeObject

Represents a native wide string.

Uses 16 bit characters.

Wide strings can only be passed or returned by functions and callbacks as a pointer to the wide string.

Since:
1.0.0 12/05/2004
See Also:
AnsiString

Constructor Summary
WideString()
          Constructs a new wide string of default size.
WideString(char[] value)
          Constructs a new wide string from the specified array of characters.
WideString(char[] value, int offset, int length)
          Constructs a new wide string from the specified array of characters.
WideString(int size)
          Constructs a new wide string of specified size.
WideString(Pointer pointer)
          Constructs a new wide string from the specified pointer to an wide string.
WideString(Pointer pointer, int size)
          Constructs a new wide string from the specified pointer to an wide string.
WideString(java.lang.String value)
          Constructs a new wide string from the specified string.
WideString(WideString value)
          Constructs a new wide string from the specified wide string.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this wide string.
 int compareTo(java.lang.Object object)
          Compares this wide string to the specified wide string.
 int compareTo(WideString string)
          Compares this wide string to the specified wide string.
 int compareToIgnoreCase(WideString string)
          Compares this wide string to the specified wide string.
 boolean equals(java.lang.Object object)
          Returns whether this wide string equals the specified wide string.
 boolean equalsIgnoreCase(WideString string)
          Returns whether this wide string equals ignoring case the specified wide string.
 java.lang.String getValue()
          Returns a String representation of this wide string.
 int hashCode()
          Returns the hash code of this wide string.
 int length()
          Returns the length in characters of this wide string.
 void setValue(char[] value)
          Sets the value of this wide string to the specified array of characters.
 void setValue(char[] value, int offset, int length)
          Sets the value of this wide string to the specified array of characters.
 void setValue(Pointer pointer)
          Sets the value of this wide string to the wide string referenced by the specified pointer to a wide string.
 void setValue(Pointer pointer, int size)
          Sets the value of this wide string to the wide string referenced by the specified pointer to a wide string.
 void setValue(java.lang.String value)
          Sets the value of this wide string to the specified String.
 void setValue(WideString value)
          Sets the value of this wide string to the specified wide string.
 java.lang.String toString()
          Returns a String representation of this wide string.
 
Methods inherited from class stec.jenie.NativeObject
getAlignment, getNativeAddress, getNativeBuffer, getNativeBufferHandle, setNativeBuffer, setNativeBuffer, setNativeBuffer, size
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WideString

public WideString()
           throws java.lang.OutOfMemoryError
Constructs a new wide string of default size.

Constructs a native buffer of 256 bytes in length for wide string.

Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(int size)
           throws java.lang.OutOfMemoryError
Constructs a new wide string of specified size.

Constructs a native buffer of (size + 1) * 2 bytes in length for wide string.

Parameters:
size - the size in characters of the wide string.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(java.lang.String value)
           throws java.lang.OutOfMemoryError
Constructs a new wide string from the specified string.

Constructs a native buffer of (string length + 1) * 2 bytes in length for wide string.

Parameters:
value - the string to use.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(char[] value)
           throws java.lang.OutOfMemoryError
Constructs a new wide string from the specified array of characters.

Constructs a native buffer of (character array length + 1) * 2 bytes in length for wide string.

Parameters:
value - the array of characters to use.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(char[] value,
                  int offset,
                  int length)
           throws java.lang.OutOfMemoryError
Constructs a new wide string from the specified array of characters.

Constructs a native buffer of (length + 1) * 2 bytes in length for wide string.

Parameters:
value - the array of characters to use.
offset - the starting offset.
length - the number of characters.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(WideString value)
           throws java.lang.OutOfMemoryError
Constructs a new wide string from the specified wide string.

Constructs a native buffer of size of the native buffer of specified wide string bytes in length for wide string.

Parameters:
value - the wide string to use.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

WideString

public WideString(Pointer pointer)
Constructs a new wide string from the specified pointer to an wide string.

Sets the size of the native buffer to -1.

Parameters:
pointer - the pointer to the wide string.

WideString

public WideString(Pointer pointer,
                  int size)
Constructs a new wide string from the specified pointer to an wide string.

Sets the native buffer size to the specified (size + 1) * 2.

Parameters:
pointer - the pointer to the wide string.
size - the native buffer in characters.
Method Detail

length

public int length()
Returns the length in characters of this wide string.


getValue

public java.lang.String getValue()
Returns a String representation of this wide string.

Returns:
the String representation of this wide string.

setValue

public void setValue(java.lang.String value)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this wide string to the specified String.

Parameters:
value - the String to use.
Throws:
java.lang.IndexOutOfBoundsException - if the length of the specified String is larger than the size of the native buffer of this wide string.

setValue

public void setValue(char[] value)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this wide string to the specified array of characters.

Parameters:
value - the array of characters to use.
Throws:
java.lang.IndexOutOfBoundsException - if the length of the specified array of characters is larger than the size of the native buffer of this wide string.

setValue

public void setValue(char[] value,
                     int offset,
                     int length)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this wide string to the specified array of characters.

Parameters:
value - the array of characters to use.
offset - the starting offset.
length - the number of bytes to use.
Throws:
java.lang.IndexOutOfBoundsException - if the length of the specified array of characters is larger than the size of the native buffer of this wide string.

setValue

public void setValue(WideString value)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this wide string to the specified wide string.

Parameters:
value - the wide string to use.
Throws:
java.lang.IndexOutOfBoundsException - if the length of the specified wide string is larger than the size of the native buffer of this wide string.

setValue

public void setValue(Pointer pointer)
Sets the value of this wide string to the wide string referenced by the specified pointer to a wide string.

Sets the size of the native buffer to -1.

Parameters:
pointer - the pointer to an wide string.

setValue

public void setValue(Pointer pointer,
                     int size)
Sets the value of this wide string to the wide string referenced by the specified pointer to a wide string.

Sets the native buffer size to the specified (size + 1) * 2.

Parameters:
pointer - the pointer to an wide string.
size - the size in characters of the referenced wide string.

toString

public java.lang.String toString()
Returns a String representation of this wide string.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of this wide string.

equals

public boolean equals(java.lang.Object object)
Returns whether this wide string equals the specified wide string.

Overrides:
equals in class NativeObject
Parameters:
object - the wide string to compare against.
Returns:
whether this wide string equals the specified wide string.

equalsIgnoreCase

public boolean equalsIgnoreCase(WideString string)
Returns whether this wide string equals ignoring case the specified wide string.

Parameters:
string - the wide string to compare against.
Returns:
whether this wide string equals ignoring case the specified wide string.

compareTo

public int compareTo(java.lang.Object object)
              throws java.lang.ClassCastException
Compares this wide string to the specified wide string.

Parameters:
object - the wide string to compare against.
Returns:
0 if this wide string is the same as the specified wide string, a negative integer if this wide string is less than the specified wide string and a positive integer if this wide string is greater than the specified wide string.
Throws:
java.lang.ClassCastException - if the specified object is not an wide string.

compareTo

public int compareTo(WideString string)
Compares this wide string to the specified wide string.

Parameters:
string - the wide string to compare against.
Returns:
0 if this wide string is the same as the specified wide string, a negative integer if this wide string is less than the specified wide string and a positive integer if this wide string is greater than the specified wide string.

compareToIgnoreCase

public int compareToIgnoreCase(WideString string)
                        throws java.lang.ClassCastException
Compares this wide string to the specified wide string.

Parameters:
object - the wide string to compare against.
Returns:
0 if this wide string is the same as the specified wide string, a negative integer if this wide string is less than the specified wide string and a positive integer if this wide string is greater than the specified wide string.
Throws:
java.lang.ClassCastException - if the specified object is not an wide string.

clone

public java.lang.Object clone()
                       throws java.lang.OutOfMemoryError
Returns a clone of this wide string.

Specified by:
clone in class NativeObject
Returns:
the clone of this wide string.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.

hashCode

public int hashCode()
Returns the hash code of this wide string.

Overrides:
hashCode in class NativeObject
Returns:
the hash code of this wide string.

Servertec
Jenie
1.0.1 09/04/2005

Copyright © 2004-2005 Servertec. All rights reserved.