public class NativeString extends NativePrimitive
Modifier and Type | Field and Description |
---|---|
private static int |
BUFFER_PADDING
Amount of extra bytes allocated to reduce the change of buffer overflows.
|
protected java.lang.String |
value
The stored value (defaults to empty string).
|
copyIn, copyOut, passByPointer, ptr, ref, type
Constructor and Description |
---|
NativeString()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getValue()
Access the data element.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
protected void |
readNative(memptr ptr)
Worker method to read the primitive value from the first index position of the given
memory buffer.
|
long |
render(long addr)
Copy our data into a large-enough buffer in native memory and then render the buffer's
address into native memory if an explicit address is provided and return the data's
address to the caller.
|
void |
setValue(java.lang.String value)
Assign the data element.
|
int |
size()
Report the size (in bytes) of the native memory needed to store this instance.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
protected void |
writeNative(memptr ptr)
Worker method to write the primitive value to the first index position of the given
memory buffer.
|
restore
isCopyIn, isCopyOut, isPassByPointer, render, restore, setCopyIn, setCopyOut, setPassByPointer, setType, type
private static int BUFFER_PADDING
protected java.lang.String value
public java.lang.String getValue()
public void setValue(java.lang.String value)
value
- The new text data element. Ignored if null
.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class BaseNativeType
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class BaseNativeType
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.public int size()
This should never be called on the server, only on the client side.
size
in class BaseNativeType
public long render(long addr)
This should never be called on the server, only on the client side.
render
in class NativePrimitive
addr
- The memory address into which the address should be rendered, if the caller
is supplying a buffer or 0 if the internally created buffer's address should be
returned directly.protected void readNative(memptr ptr)
readNative
in class NativePrimitive
ptr
- The memory buffer to reference.protected void writeNative(memptr ptr)
writeNative
in class NativePrimitive
ptr
- The memory buffer to reference.