|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.cldc.jna.Structure
public abstract class Structure
Abstract class for proxies to native structure types.
Field Summary | |
---|---|
protected Pointer |
backingNativeMemory
|
static Structure |
NULL
Singleton object that can be used as a NULL structure instance. |
Constructor Summary | |
---|---|
protected |
Structure()
|
protected |
Structure(Pointer backingNativeMemory)
|
Method Summary | |
---|---|
void |
allocateMemory()
Attempt to allocate backing memory for the structure. |
void |
allocateMemory(int size)
Attempt to allocate backing memory for the structure. |
void |
clear()
Set the backing memory to zeros. |
void |
freeMemory()
Free the backing memory for the structure. |
Pointer |
getPointer()
Get the backing native memory used by this structure. |
abstract void |
read()
Copy the fields of the struct from native memory to the Java fields |
void |
release()
Release the backing memory for the structure, if it was malloced |
abstract int |
size()
|
String |
toString()
Returns a string representation of the object. |
void |
useMemory(Pointer m)
Set the backing native memory used by this structure. |
abstract void |
write()
Copy the java fields of the struct to native memory from the Java fields |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Pointer backingNativeMemory
public static final Structure NULL
Constructor Detail |
---|
protected Structure(Pointer backingNativeMemory)
protected Structure()
Method Detail |
---|
public abstract void read()
public abstract void write()
public abstract int size()
public final Pointer getPointer()
public final void useMemory(Pointer m)
m
- the native memory
IllegalStateException
- if this structure already has memory allocatedpublic void allocateMemory() throws OutOfMemoryError
OutOfMemoryError
- if backing native memory cannot be allocated.
IllegalStateException
- if this structure already has memory allocatedpublic void allocateMemory(int size) throws OutOfMemoryError
size
- in bytes ito allocate
IllegalArgumentException
- if the requested size is smaller than the default size
OutOfMemoryError
- if backing native memory cannot be allocated.
IllegalStateException
- if this structure already has memory allocatedpublic void freeMemory() throws IllegalStateException
IllegalStateException
- if the memory has already been freed.public void release() throws IllegalStateException
IllegalStateException
- if the memory has already been freed.public void clear()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class Object
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |