|
|||||||||||
| 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.WideString
Represents Unicode string (wchar_t[n]) value and type, where n is the length of the buffer..
void foo(wchar_t* aString), you
can wrap this object to a Pointer or pass this object as is. In second case JNIWrapper will automatically wrap this string into Pointer for you.
For example:
WideString aString = new WideString("String value");
function.invoke(null, aString);
//or
function.invoke(null, new Pointer(aString));
In case when you need to wrap a structure that contains a string member, for example:
struct a {
wchar_t name[10];
}
You can use the following wrapper:
public class A extendsIn case if a structure contains a char* member, for example:Structure{ private WideString name = new WideString(10); // corresponds towchar_t name[10]public A() { init(new Parameter[] {name}); } }
struct a {
wchar_t name*;
}
Then you can use the following wrapper for it:
public class A extendsNOTE: All string lengths include the terminating zero character unless otherwise noted. This class should be used directly only if Unicode characters are required. UseStructure{ Pointer name = newPointer(WideString.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.
AnsiString,
Str| Field Summary |
| Fields inherited from class com.jniwrapper.Parameter |
LICENSE_TYPE, V |
| Constructor Summary | |
WideString()
Constructs a string with the maximum length of 256 characters. |
|
WideString(int maxLen)
Constructs a string with a specified maximum length. |
|
WideString(java.lang.String s)
Constructs a string with a specified value. |
|
WideString(java.lang.String s,
int maxLen)
Constructs a string with a specified value and maximum length. |
|
WideString(WideString t)
Constructs a copy of a specified AnsiString object. |
|
| Method Summary | |
protected java.lang.String |
bytesToString(byte[] bytes)
|
java.lang.Object |
clone()
|
int |
getAlignmentRequirement()
|
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, getFirstMemberSize, 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 WideString()
public WideString(int maxLen)
public WideString(java.lang.String s)
public WideString(java.lang.String s,
int maxLen)
public WideString(WideString 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 Parameter
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||