|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.nio.JMemory
org.jnetpcap.nio.JNumber
public class JNumber
A peered number pointer class that stores and retrieves number values from native/direct memory locations. This class facilitates exchange of number values (from bytes to doubles) to various native functions. The key being that these numbers at JNI level can be passed in as pointers and thus allows natives methods to both send and receive values between native and java space. The methods are named similarly like java.lang.Number class, with the exception of existance of setter methods.
Typical usage for JNumber is to use it wherever a function requests a primitive type pointer.
| Nested Class Summary | |
|---|---|
static class |
JNumber.Type
Used to request a specific type of primitive that this number will be dealing with possibly allocating memory more efficiently to fit the primitive type. |
| Field Summary |
|---|
| Fields inherited from class org.jnetpcap.nio.JMemory |
|---|
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER |
| Constructor Summary | |
|---|---|
JNumber()
Allocates a JNumber object capable of storing the biggest primitive on this platform. |
|
JNumber(JMemory.Type type)
Creates a number pointer, which does not allocate any memory on its own, but needs to be peered with primitive pointer. |
|
JNumber(JNumber.Type type)
Allocates a number of the specified size and type. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Gets value from native memory. |
void |
byteValue(byte value)
Sets new value in native memory. |
double |
doubleValue()
Gets value from native memory. |
void |
doubleValue(double value)
Sets new value in native memory. |
float |
floatValue()
Gets value from native memory. |
void |
floatValue(float value)
Sets new value in native memory. |
int |
intValue()
Returns the data from this JNUmber as a signed integer. |
void |
intValue(int value)
Sets new value in native memory. |
long |
longValue()
Gets value from native memory. |
void |
longValue(long value)
Sets new value in native memory. |
int |
peer(JBuffer buffer)
Peers with supplied buffer object. |
int |
peer(JBuffer buffer,
int offset)
Peers with supplied buffer object. |
int |
peer(JNumber number)
Peers with supplied number object. |
short |
shortValue()
Gets value from native memory. |
void |
shortValue(short value)
Sets new value in native memory. |
int |
transferFrom(java.nio.ByteBuffer buffer)
Copies data out of the supplied buffer into this number object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JNumber()
public JNumber(JNumber.Type type)
type - primitive type for which to allocate memorypublic JNumber(JMemory.Type type)
type - memory model| Method Detail |
|---|
public int intValue()
public void intValue(int value)
value - new valuepublic byte byteValue()
public void byteValue(byte value)
value - new valuepublic short shortValue()
public void shortValue(short value)
value - new valuepublic long longValue()
public void longValue(long value)
value - new valuepublic float floatValue()
public void floatValue(float value)
value - new valuepublic double doubleValue()
public void doubleValue(double value)
value - new valuepublic int peer(JNumber number)
number - number object to peer with
public int peer(JBuffer buffer)
buffer - buffer to peer with
public int peer(JBuffer buffer,
int offset)
buffer - buffer to peer withoffset - offset into supplied buffer
public int transferFrom(java.nio.ByteBuffer buffer)
transferFrom in class JMemorybuffer - buffer to copy data out of. Buffer's position and limit properties
set the bounds for the copy
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||