public class WideString extends ZeroTerminatedString
wchar_t[n]) value and type, where n is the length of the buffer..
NOTE: Please keep in mind that this class is the memory buffer of specified length, but not the pointer.
Theretofore when you need to pass this object to a native function call, for example: 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.Structure{ Pointer name = newPointer(WideString.class); // corresponds tochar name*public A() { init(new Parameter[] {name}); } }
This class should be used directly only if Unicode characters are required.
Use Str class for working with string values to make your code compatible with
both Unicode and non-Unicode platforms.
AnsiString,
StrLICENSE_TYPE, V| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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) |
asReturnValue, equals, getAlignedLength, getDebugInfo, getFirstMemberSize, getLength, getMaxLength, getValue, hashCode, read, setValue, toString, writeacceptIOPerformer, dataBufferAssigned, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, writepublic 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.protected java.lang.String bytesToString(byte[] bytes)
bytesToString in class ZeroTerminatedStringprotected byte[] stringToBytes(java.lang.String value)
stringToBytes in class ZeroTerminatedStringprotected int getStrLen(DataBuffer dataBuffer, int startOffset)
getStrLen in class ZeroTerminatedStringpublic int getAlignmentRequirement()
getAlignmentRequirement in class Parameter