|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.j2native.Argument | +--com.smardec.j2native.ZeroTerminatedString
ZeroTerminatedString
class is a base class for all types of
zero-terminated strings.
NOTE: All string lengths include a terminating zero character unless otherwise noted.
Field Summary |
Fields inherited from class com.smardec.j2native.Argument |
JAVA_SIDE, NATIVE_SIDE |
Constructor Summary | |
protected |
ZeroTerminatedString(java.lang.String string)
Constructs a string with specified value |
protected |
ZeroTerminatedString(java.lang.String string,
int maxSize)
Constructs a string with specified value and sets maximum chars quantity |
Method Summary | |
protected abstract byte |
getCharLength()
Returns the character length |
int |
getLength()
Additional info: due to every zero-terminated ends with zero value we add additional character to encode zero. |
int |
getMaxSize()
Getter for string argument maximum size |
java.lang.String |
getValue()
Getter for the string value of the argument |
boolean |
isAutoResize()
Shows if string argument is autoresizeable. |
protected boolean |
isFixedLength()
Identify if Argument is a fixed length variable. |
protected void |
read(long handle,
int offset)
Reads itself from the memory. |
void |
readFromStack(byte[] stack,
int offset)
Read itself from stack. |
void |
setAutoResize(boolean autoResize)
Sets an auto resizeable property. |
void |
setMaxSize(int maxSize)
Additional note: as autoResize property prevails to
maxSize property, you have to set autoResize to
false value before setting maxSize property. |
void |
setValue(java.lang.String value)
Sets the value for the argument. |
protected long |
storeToRAM()
Stores itself to the native memory. |
protected void |
write(long handle,
int offset)
Writes itself to the memory. |
void |
writeToStack(byte[] stack,
int offset)
Writes itself to stack. |
Methods inherited from class com.smardec.j2native.Argument |
clone, finalize, free, fromBytesValue, getAlignedLength, getResultFlags, readFromRAM, restoreFromRAM, toBytesValue, toBytesValue, update, writeToRAM |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ZeroTerminatedString(java.lang.String string)
string
- the value to set.protected ZeroTerminatedString(java.lang.String string, int maxSize)
string
- the value to set.maxSize
- maximum size of the string argument in charactersMethod Detail |
public boolean isAutoResize()
StringType
isAutoResize
in interface StringType
public void setAutoResize(boolean autoResize)
StringType
setAutoResize
in interface StringType
autoResize
- autoresizeabilitypublic int getMaxSize()
StringType
getMaxSize
in interface StringType
public void setMaxSize(int maxSize)
autoResize
property prevails to
maxSize
property, you have to set autoResize
to
false
value before setting maxSize
property.
setMaxSize
in interface StringType
maxSize
- maximum size of the string argumentpublic final void setValue(java.lang.String value)
StringType
setValue
in interface StringType
value
- the value to set.public final java.lang.String getValue()
StringType
getValue
in interface StringType
protected abstract byte getCharLength()
public int getLength()
getLength
in class Argument
public void writeToStack(byte[] stack, int offset)
Argument
writeToStack
in class Argument
stack
- it's byte array, where Argument
will be writtenoffset
- offset in stackpublic void readFromStack(byte[] stack, int offset)
Argument
readFromStack
in class Argument
stack
- it's byte array, from which Argument
will be restoredoffset
- offset in stackprotected boolean isFixedLength()
Argument
Argument
is a fixed length variable.
isFixedLength
in class Argument
true
if it is so, and false
otherwiseprotected long storeToRAM()
Argument
Argument
takes care of memory allocation and
writes itself to this allocated memory. After all operations complete method returns this memory address.
storeToRAM
in class Argument
protected final void write(long handle, int offset)
Argument
write
in class Argument
handle
- identifies location in memory where Argument
will be writtenoffset
- memory address offsetprotected final void read(long handle, int offset)
Argument
read
in class Argument
handle
- identifies location in memory from which Argument
will be readoffset
- memory address offset
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |