Servertec
Jenie
1.0.1 09/04/2005

stec.jenie
Class AnsiString

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

public class AnsiString
extends NativeObject

Represents a native ANSI string.

Uses 8 bit characters.

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

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

Constructor Summary
AnsiString()
          Constructs a new ANSI string of default size.
AnsiString(AnsiString value)
          Constructs a new ANSI string from the specified ANSI string.
AnsiString(byte[] value)
          Constructs a new ANSI string from the specified array of bytes.
AnsiString(byte[] value, int offset, int length)
          Constructs a new ANSI string from the specified array of bytes.
AnsiString(int size)
          Constructs a new ANSI string of specified size.
AnsiString(Pointer pointer)
          Constructs a new ANSI string from the specified pointer to an ANSI string.
AnsiString(Pointer pointer, int size)
          Constructs a new ANSI string from the specified pointer to an ANSI string.
AnsiString(java.lang.String value)
          Constructs a new ANSI string from the specified string.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this ANSI string.
 int compareTo(AnsiString string)
          Compares this ANSI string to the specified ANSI string.
 int compareTo(java.lang.Object object)
          Compares this ANSI string to the specified ANSI string.
 int compareToIgnoreCase(AnsiString string)
          Compares ignoring case this ANSI string to the specified ANSI string.
 boolean equals(java.lang.Object object)
          Returns whether this ANSI string equals the specified ANSI string.
 boolean equalsIgnoreCase(AnsiString string)
          Returns whether this ANSI string equals ignoring case the specified ANSI string.
 java.lang.String getValue()
          Returns a String representation of this ANSI string.
 int hashCode()
          Returns the hash code of this ANSI string.
 int length()
          Returns the length in bytes of this ANSI string.
 void setValue(AnsiString value)
          Sets the value of this ANSI string to the specified ANSI string.
 void setValue(byte[] value)
          Sets the value of this ANSI string to the specified array of bytes.
 void setValue(byte[] value, int offset, int length)
          Sets the value of this ANSI string to the specified array of bytes.
 void setValue(Pointer pointer)
          Sets the value of this ANSI string to the ANSI string referenced by the specified pointer to an ANSI string.
 void setValue(Pointer pointer, int size)
          Sets the value of this ANSI string to the ANSI string referenced by the specified pointer to an ANSI string.
 void setValue(java.lang.String value)
          Sets the value of this ANSI string to the specified String.
 java.lang.String toString()
          Returns a String representation of this ANSI 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

AnsiString

public AnsiString()
           throws java.lang.OutOfMemoryError
Constructs a new ANSI string of default size.

Constructs a native buffer of 128 bytes in length for ANSI string.

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

AnsiString

public AnsiString(int size)
           throws java.lang.OutOfMemoryError,
                  java.lang.IllegalArgumentException
Constructs a new ANSI string of specified size.

Constructs a native buffer of size + 1 bytes in length for ANSI string.

Parameters:
size - the size in bytes of the ANSI string.
Throws:
java.lang.OutOfMemoryError - if there is not enough free memory.
java.lang.IllegalArgumentException - if any of the specified parameters are invalid.

AnsiString

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

Constructs a native buffer of string length + 1 bytes in length for ANSI string.

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

AnsiString

public AnsiString(byte[] value)
           throws java.lang.OutOfMemoryError
Constructs a new ANSI string from the specified array of bytes.

Constructs a native buffer of byte array length + 1 bytes in length for ANSI string.

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

AnsiString

public AnsiString(byte[] value,
                  int offset,
                  int length)
           throws java.lang.OutOfMemoryError
Constructs a new ANSI string from the specified array of bytes.

Constructs a native buffer of length + 1 bytes in length for ANSI string.

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

AnsiString

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

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

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

AnsiString

public AnsiString(Pointer pointer)
Constructs a new ANSI string from the specified pointer to an ANSI string.

Sets the size of the native buffer to -1.

Parameters:
pointer - the pointer to the ANSI string.

AnsiString

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

Sets the native buffer size to the specified size + 1.

Parameters:
pointer - the pointer to the ANSI string.
size - the native buffer in bytes.
Method Detail

length

public int length()
Returns the length in bytes of this ANSI string.


getValue

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

Returns:
the String representation of this ANSI string.

setValue

public void setValue(java.lang.String value)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this ANSI 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 ANSI string.

setValue

public void setValue(byte[] value)
              throws java.lang.IndexOutOfBoundsException
Sets the value of this ANSI string to the specified array of bytes.

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

setValue

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

Parameters:
value - the array of bytes 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 bytes is larger than the size of the native buffer of this ANSI string.

setValue

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

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

setValue

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

Sets the size of the native buffer to -1.

Parameters:
pointer - the pointer to an ANSI string.

setValue

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

Sets the native buffer size to the specified size + 1.

Parameters:
pointer - the pointer to an ANSI string.
size - the size in bytes of the referenced ansi string.

toString

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

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

equals

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

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

equalsIgnoreCase

public boolean equalsIgnoreCase(AnsiString string)
Returns whether this ANSI string equals ignoring case the specified ANSI string.

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

compareTo

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

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

compareTo

public int compareTo(AnsiString string)
Compares this ANSI string to the specified ANSI string.

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

compareToIgnoreCase

public int compareToIgnoreCase(AnsiString string)
Compares ignoring case this ANSI string to the specified ANSI string.

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

clone

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

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

hashCode

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

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

Servertec
Jenie
1.0.1 09/04/2005

Copyright © 2004-2005 Servertec. All rights reserved.