com.jniwrapper
Class StringArray

java.lang.Object
  extended by com.jniwrapper.Parameter
      extended by com.jniwrapper.StringArray

public class StringArray
extends Parameter

Represents a string array where strings are delimited by the zero character. When not explicitely defined the type of characters depends on the Unicode support of an operating system under which the code is being executed. To set the required character type use the StringArray(boolean unicode) constructor.

Since:
2.3

Field Summary
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
StringArray()
          Constructs a string array with the maximum length of 1024 characters.
StringArray(boolean unicode)
          Constructs a string array with a specified character type and the maximum length of 1024 characters.
StringArray(int maxLen)
          Constructs a string array with a specified maximum length.
StringArray(int maxLen, boolean unicode)
          Constructs a string array with a specified maximum length and character type.
StringArray(java.lang.String[] s)
          Constructs a string array with a specified value.
StringArray(java.lang.String[] s, boolean unicode)
          Constructs a string array with a specified value and character type.
StringArray(java.lang.String[] s, int maxLen)
          Constructs a string array with a specified value and maximum length.
StringArray(java.lang.String[] s, int maxLen, boolean unicode)
          Constructs a string array with a specified value, maximum length and character type.
StringArray(StringArray s)
          Constructs a copy of the passed instance.
 
Method Summary
protected  void acceptIOPerformer(IOPerformer performer, DataBuffer buffer, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
          Implementation of a Visitor pattern for parameter IO.
protected  Parameter asReturnValue()
          Returns a parameter that represents this one as a return value.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
          Compares this Parameter object to a given object.
protected  int getAlignedLength()
          Returns a parameter length in bytes aligned to default alignment.
 int getAlignmentRequirement()
           
protected  DataBuffer getDataBuffer()
          Returns a current data storage.
protected  int getDataBufferOffset()
          Returns a current offset within data storage.
 java.lang.String getDebugInfo()
          Return debug info for JNIWrapper parameter.
 int getLength()
          Returns the length of the parameter in memory.
 int getMaxLength()
           
 java.lang.String[] getValue()
           
 int hashCode()
           
 boolean isUnicode()
           
 void pop(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Default implementation that does nothing because most primitive types do nothing on pop.
 void push(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Writes a parameter to a function stacks.
 void read(byte[] arr, int offset)
          Reads the parameter value from a byte array.
 void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Reads this parameter from a specified data source.
protected  void setDataBuffer(DataBuffer newBuffer, int newOffset, boolean shouldRead)
          Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.
 void setValue(java.lang.String[] value)
           
 void write(byte[] arr, int offset)
          Writes the parameter value to a byte array.
 void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Writes this parameter to a specified data source.
 
Methods inherited from class com.jniwrapper.Parameter
dataBufferAssigned, indent, read, toByteArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringArray

public StringArray()
Constructs a string array with the maximum length of 1024 characters.


StringArray

public StringArray(boolean unicode)
Constructs a string array with a specified character type and the maximum length of 1024 characters.


StringArray

public StringArray(java.lang.String[] s)
Constructs a string array with a specified value. The maximum length of the string equals the length of the specified value (including terminating zeros).


StringArray

public StringArray(java.lang.String[] s,
                   boolean unicode)
Constructs a string array with a specified value and character type. The maximum length of the string equals the length of the specified value (including terminating zeros).


StringArray

public StringArray(int maxLen)
Constructs a string array with a specified maximum length.


StringArray

public StringArray(int maxLen,
                   boolean unicode)
Constructs a string array with a specified maximum length and character type.


StringArray

public StringArray(java.lang.String[] s,
                   int maxLen)
Constructs a string array with a specified value and maximum length.


StringArray

public StringArray(java.lang.String[] s,
                   int maxLen,
                   boolean unicode)
Constructs a string array with a specified value, maximum length and character type.


StringArray

public StringArray(StringArray s)
Constructs a copy of the passed instance.

Parameters:
s - a string value to copy from.
Method Detail

isUnicode

public boolean isUnicode()
Returns:
true if the contained string data is in Unicode; otherwise false.

getLength

public int getLength()
Description copied from class: Parameter
Returns the length of the parameter in memory. This method is similar to C sizeof() operator.

Specified by:
getLength in class Parameter

getAlignedLength

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

Overrides:
getAlignedLength 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

getDataBufferOffset

protected int getDataBufferOffset()
Description copied from class: Parameter
Returns a current offset within data storage.

Overrides:
getDataBufferOffset in class Parameter

getDataBuffer

protected DataBuffer getDataBuffer()
Description copied from class: Parameter
Returns a current data storage.

Overrides:
getDataBuffer in class Parameter

setDataBuffer

protected void setDataBuffer(DataBuffer newBuffer,
                             int newOffset,
                             boolean shouldRead)
Description copied from class: Parameter
Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.

Overrides:
setDataBuffer in class Parameter

write

public void write(byte[] arr,
                  int offset)
Description copied from class: Parameter
Writes the parameter value to a byte array.

Overrides:
write in class Parameter

read

public void read(byte[] arr,
                 int offset)
Description copied from class: Parameter
Reads the parameter value from a byte array.

Overrides:
read in class Parameter

acceptIOPerformer

protected void acceptIOPerformer(IOPerformer performer,
                                 DataBuffer buffer,
                                 int initialOffset,
                                 boolean isReadOperation,
                                 boolean invokedByCallback)
Description copied from class: Parameter
Implementation of a Visitor pattern for parameter IO. A performer is responsible for reading and writing the parameter. Users implementing a complex parameter from scratch (i.e. not by extending a pre-existing class such as Structure or Pointer) may wish to override this method to make a performer visit object internal parts.

Overrides:
acceptIOPerformer in class Parameter
Parameters:
performer - a visitor responsible for I/Oing the parameter.
buffer - data buffer for I/O operation.
initialOffset - I/O operation offset of this parameter in the buffer.

getAlignmentRequirement

public int getAlignmentRequirement()
Overrides:
getAlignmentRequirement in class Parameter
Returns:
required alignment within a structure or an array

push

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

Overrides:
push in class Parameter
Throws:
MemoryAccessViolationException

pop

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

Overrides:
pop in class Parameter
Throws:
MemoryAccessViolationException

write

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

Specified by:
write in class Parameter
Throws:
MemoryAccessViolationException

read

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

Specified by:
read in class Parameter
Throws:
MemoryAccessViolationException

clone

public java.lang.Object clone()
Specified by:
clone in class Parameter

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 - a value to compare this object to.
Returns:
true if two objects are equal.

hashCode

public int hashCode()
Overrides:
hashCode in class Parameter

getMaxLength

public int getMaxLength()

setValue

public void setValue(java.lang.String[] value)

getValue

public java.lang.String[] getValue()

getDebugInfo

public java.lang.String getDebugInfo()
Description copied from class: Parameter
Return debug info for JNIWrapper parameter.

Specified by:
getDebugInfo in class Parameter
Returns:
debug info