com.jniwrapper
Class ZeroTerminatedString

java.lang.Object
  |
  +--com.jniwrapper.Parameter
        |
        +--com.jniwrapper.ZeroTerminatedString
Direct Known Subclasses:
AnsiString, WideString

public abstract class ZeroTerminatedString
extends Parameter

Base class for all types of zero-terminated strings.

NOTE: All string lengths include the terminating zero character unless otherwise noted.


Constructor Summary
protected ZeroTerminatedString(java.lang.String s, int len, int charLength)
          Constructs string with specified value, maximum length and characted type (1-byte or 2-byte)
 
Method Summary
protected  Parameter asReturnValue()
          Returns a parameter that represents this one as a return value.
 boolean equals(java.lang.Object obj)
          Compares this Parameter object to a given object.
protected  int getAlignedLength()
          Returns parameter length in bytes aligned to default alignment.
protected  int getCharLength()
          Returns character length in bytes
 int getLength()
          Returns length of this string object.
 int getMaxLength()
          Returns maximum length of a string
abstract  java.lang.String getValue()
          Returns string value
 void pop(DataBuffer stackBuffer, int offset)
          Default implementation, which does nothing as most primitive types do nothing on pop.
 void push(DataBuffer stackBuffer, int offset)
          Writes a parameter to a function stacks
 void read(DataBuffer stackBuffer, int offset)
          Reads this parameter from a specified data source.
abstract  void setValue(java.lang.String val)
          Sets string value
 java.lang.String toString()
           
 void write(DataBuffer stackBuffer, int offset)
          Writes this parameter to a specified data source.
 
Methods inherited from class com.jniwrapper.Parameter
acceptIOPerformer, clone, getBuffer, getOffset, indent, read, setBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZeroTerminatedString

protected ZeroTerminatedString(java.lang.String s,
                               int len,
                               int charLength)
Constructs string with specified value, maximum length and characted type (1-byte or 2-byte)

Method Detail

getMaxLength

public int getMaxLength()
Returns maximum length of a string


setValue

public abstract void setValue(java.lang.String val)
Sets string value


getValue

public abstract java.lang.String getValue()
Returns string value


getCharLength

protected int getCharLength()
Returns character length in bytes


getLength

public int getLength()
Returns length of this string object. This value is not necessarily equal to the allowed maximum length of the string. To get the latter use getMaxLength() method.

Specified by:
getLength in class Parameter

getAlignedLength

protected int getAlignedLength()
Description copied from class: Parameter
Returns parameter length in bytes aligned to default alignment.

Overrides:
getAlignedLength in class Parameter

push

public void push(DataBuffer stackBuffer,
                 int offset)
Description copied from class: Parameter
Writes a parameter to a function stacks

Overrides:
push in class Parameter

asReturnValue

protected Parameter asReturnValue()
Description copied from class: Parameter
Returns a parameter that represents this one as a return value. Implementors may use this as a convenience shortcut for users when implementing such objects as strings or arrays to allow users to specify an object as a return value instead of requiring a pointer to it. For general use the default implementation should suffice.

Overrides:
asReturnValue in class Parameter
Returns:
this

pop

public void pop(DataBuffer stackBuffer,
                int offset)
         throws MemoryAccessViolationException
Description copied from class: Parameter
Default implementation, which does nothing as most primitive types do nothing on pop. Reads a parameter from a function stack.

Overrides:
pop in class Parameter
MemoryAccessViolationException

write

public void write(DataBuffer stackBuffer,
                  int offset)
           throws MemoryAccessViolationException
Description copied from class: Parameter
Writes this parameter to a specified data source.

Specified by:
write in class Parameter
MemoryAccessViolationException

read

public void read(DataBuffer stackBuffer,
                 int offset)
          throws MemoryAccessViolationException
Description copied from class: Parameter
Reads this parameter from a specified data source.

Specified by:
read in class Parameter
MemoryAccessViolationException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Parameter
Compares this Parameter object to a given object. Two Parameter objects are considered equal if their byte representations are equal and they are of the same type. Subclasses may override this method as appropriate.

Overrides:
equals in class Parameter
Parameters:
obj - value to compare this object to
Returns:
true if two objects are equal.