|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jniwrapper.Parameter
com.jniwrapper.ZeroTerminatedString
com.jniwrapper.AnsiString
Represents a zero-terminated string of an 8-bit (ANSI) character declared in
C as char[n], where n is the length of the buffer.
void foo(char* aString), you
can wrap this object to a Pointer or pass this object as is. In second case JNIWrapper will atomatically wrap this string into Pointer for you.
For example:
AnsiString aString = new AnsiString("String value");
function.invoke(null, aString);
//or
function.invoke(null, new Pointer(aString));
In case when you need to wrap a structure that contains char[n] member, for example:
struct a {
char name[10];
}
You can use the following wrapper:
public class A extendsIn case if a structure contains a char* member, for example:Structure{ AnsiString name = new AnsiString(10); // corresponds tochar name[10]public A() { init(new Parameter[] {name}); } }
struct a {
char name*;
}
Then you can use the following wrapper for it:
public class A extendsNOTE: All string lengths include a terminating zero character unless otherwise noted. This class should be used directly only if 8-bit characters are required. UseStructure{ Pointer name = newPointer(AnsiString.class); // corresponds tochar name*public A() { init(new Parameter[] {name}); } }
Str class for working with string values to make your code compatible with
both Unicode and non-Unicode platforms.
Str,
WideString| Field Summary |
| Fields inherited from class com.jniwrapper.Parameter |
LICENSE_TYPE, V |
| Constructor Summary | |
AnsiString()
Constructs a string with the maximum length of 256 characters. |
|
AnsiString(AnsiString t)
Constructs a copy of a specified AnsiString object. |
|
AnsiString(byte[] bytes)
Creates the string from the specifies byte array. |
|
AnsiString(byte[] bytes,
int length)
Creates the string from the specifies byte array. |
|
AnsiString(int maxLen)
Constructs a string with a specified maximum length. |
|
AnsiString(java.lang.String s)
Constructs a string with a specified value. |
|
AnsiString(java.lang.String s,
int maxLen)
Constructs a string with a specified value and maximum length. |
|
| Method Summary | |
protected java.lang.String |
bytesToString(byte[] bytes)
|
java.lang.Object |
clone()
|
int |
getAlignmentRequirement()
|
int |
getFirstMemberSize()
Should return first member size. |
protected int |
getStrLen(DataBuffer dataBuffer,
int startOffset)
|
protected byte[] |
stringToBytes(java.lang.String value)
|
| Methods inherited from class com.jniwrapper.ZeroTerminatedString |
asReturnValue, equals, getAlignedLength, getDebugInfo, getLength, getMaxLength, getValue, hashCode, read, setValue, toString, write |
| Methods inherited from class com.jniwrapper.Parameter |
acceptIOPerformer, dataBufferAssigned, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AnsiString()
public AnsiString(int maxLen)
public AnsiString(java.lang.String s)
public AnsiString(java.lang.String s,
int maxLen)
public AnsiString(byte[] bytes)
bytes - a byte array to create the structure from
public AnsiString(byte[] bytes,
int length)
bytes - a byte array to create the structure fromlength - specifies the length of the stringpublic AnsiString(AnsiString t)
AnsiString object.
| Method Detail |
protected java.lang.String bytesToString(byte[] bytes)
bytesToString in class ZeroTerminatedStringprotected byte[] stringToBytes(java.lang.String value)
stringToBytes in class ZeroTerminatedStringpublic java.lang.Object clone()
clone in class Parameter
protected int getStrLen(DataBuffer dataBuffer,
int startOffset)
getStrLen in class ZeroTerminatedStringpublic int getAlignmentRequirement()
getAlignmentRequirement in class Parameterpublic int getFirstMemberSize()
AlignmentAwareParameter
getFirstMemberSize in interface AlignmentAwareParametergetFirstMemberSize in class ZeroTerminatedString
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||