public final class SwappedMemoryIO extends java.lang.Object implements MemoryIO, DirectMemoryIO
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ADDRESS_SIZE |
protected static int |
LONG_SIZE |
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
asByteBuffer()
Creates a view of this memory object as a java NIO byte buffer.
|
SwappedMemoryIO |
dup()
Duplicates this MemoryIO, including its contents.
|
boolean |
equals(java.lang.Object obj) |
void |
get(long offset,
byte[] dst,
int off,
int len)
Reads an array of bytes from the memory area at the specified offset.
|
void |
get(long offset,
double[] dst,
int off,
int len)
Reads an array of doubles from the memory area at the specified offset.
|
void |
get(long offset,
float[] dst,
int off,
int len)
Reads an array of floats from the memory area at the specified offset.
|
void |
get(long offset,
int[] dst,
int off,
int len)
Reads an array of ints from the memory area at the specified offset.
|
void |
get(long offset,
long[] dst,
int off,
int len)
Reads an array of longs from the memory area at the specified offset.
|
void |
get(long offset,
short[] dst,
int off,
int len)
Reads an array of shorts from the memory area at the specified offset.
|
long |
getAddress() |
long |
getAddress(long offset)
Reads a pointer value at the specified offset within the memory area.
|
byte |
getByte(long offset)
Reads an 8 bit integer value from the memory area.
|
double |
getDouble(long offset)
Reads a double value from the memory area.
|
float |
getFloat(long offset)
Reads a float value from the memory area.
|
int |
getInt(long offset)
Reads a 32 bit integer value from the memory area.
|
long |
getLong(long offset)
Reads a 64 bit integer value from the memory area.
|
DirectMemoryIO |
getMemoryIO(long offset)
Reads a pointer value at the specified offset within the memory area, and
wraps it in an abstract memory accessor.
|
long |
getNativeLong(long offset)
Reads a native long integer value from the memory area.
|
short |
getShort(long offset)
Reads a 16 bit integer value from the memory area.
|
byte[] |
getZeroTerminatedByteArray(long offset)
Reads a zero terminated byte array (e.g.
|
byte[] |
getZeroTerminatedByteArray(long offset,
int maxlen)
Reads a zero terminated byte array (e.g.
|
int |
hashCode() |
int |
indexOf(long offset,
byte value)
Gets the first index within the memory area of a particular 8 bit value.
|
int |
indexOf(long offset,
byte value,
int maxlen)
Gets the first index within the memory area of a particular 8 bit value.
|
boolean |
isDirect()
Checks if the memory area is a native memory pointer.
|
boolean |
isNull()
Checks if the memory area is NULL.
|
java.nio.ByteOrder |
order()
Gets the
ByteOrder this MemoryIO instance will read/write
values to memory in. |
void |
put(long offset,
byte[] src,
int off,
int len)
Writes an array of bytes to the memory area at the specified offset.
|
void |
put(long offset,
double[] src,
int off,
int len)
Writes an array of doubles to the memory area at the specified offset.
|
void |
put(long offset,
float[] src,
int off,
int len)
Writes an array of floats to the memory area at the specified offset.
|
void |
put(long offset,
int[] src,
int off,
int len)
Writes an array of ints to the memory area at the specified offset.
|
void |
put(long offset,
long[] src,
int off,
int len)
Writes an array of longs to the memory area at the specified offset.
|
void |
put(long offset,
short[] src,
int off,
int len)
Writes an array of shorts to the memory area at the specified offset.
|
void |
putAddress(long offset,
long value)
Writes a pointer value to the memory area at the specified offset.
|
void |
putByte(long offset,
byte value)
Writes an 8 bit integer value to the memory area at the specified offset.
|
void |
putDouble(long offset,
double value)
Writes a 64 bit float value to the memory area at the specified offset.
|
void |
putFloat(long offset,
float value)
Writes a 32 bit float value to the memory area at the specified offset.
|
void |
putInt(long offset,
int value)
Writes a 32 bit integer value to the memory area at the specified offset.
|
void |
putLong(long offset,
long value)
Writes a 64 bit integer value to the memory area at the specified offset.
|
void |
putMemoryIO(long offset,
MemoryIO value)
Writes a pointer value to the memory area at the specified offset.
|
void |
putNativeLong(long offset,
long value)
Writes a native long integer value to the memory area at the specified offset.
|
void |
putShort(long offset,
short value)
Writes a 16 bit integer value to the memory area at the specified offset.
|
void |
putZeroTerminatedByteArray(long offset,
byte[] bytes,
int off,
int len)
Writes a byte array to memory, and appends a zero terminator
|
void |
setMemory(long offset,
long size,
byte value)
Sets the contents of the memory area to the value.
|
SwappedMemoryIO |
slice(long offset)
Creates a new MemoryIO pointing to a subset of the memory area of this
MemoryIO.
|
SwappedMemoryIO |
slice(long offset,
long size)
Creates a new MemoryIO pointing to a subset of the memory area of this
MemoryIO.
|
protected static final int LONG_SIZE
protected static final int ADDRESS_SIZE
public final java.nio.ByteOrder order()
MemoryIOByteOrder this MemoryIO instance will read/write
values to memory in.public final long getAddress()
getAddress in interface DirectMemoryIOpublic SwappedMemoryIO slice(long offset)
MemoryIOpublic SwappedMemoryIO slice(long offset, long size)
MemoryIOpublic SwappedMemoryIO dup()
MemoryIOpublic final java.nio.ByteBuffer asByteBuffer()
MemoryIOasByteBuffer in interface MemoryIOpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final boolean isNull()
MemoryIOpublic final boolean isDirect()
MemoryIOpublic final byte getByte(long offset)
MemoryIOpublic final short getShort(long offset)
MemoryIOpublic final int getInt(long offset)
MemoryIOpublic final long getLong(long offset)
MemoryIOpublic final long getNativeLong(long offset)
MemoryIOA native long is 32bits on either ILP32 or LLP64 architectures, and 64 bits on an LP64 architecture.
This means that it will always read a 32bit value on Windows, but on Unix systems such as MacOS or Linux, it will read a 32bit value on 32bit systems, and a 64bit value on 64bit systems.
getNativeLong in interface MemoryIOoffset - The offset within the memory area to read the value.public final float getFloat(long offset)
MemoryIOpublic final double getDouble(long offset)
MemoryIOpublic final long getAddress(long offset)
MemoryIOgetAddress in interface MemoryIOoffset - The offset within the memory area to read the value.public final DirectMemoryIO getMemoryIO(long offset)
MemoryIOgetMemoryIO in interface MemoryIOoffset - The offset within the memory area to read the value.public final void putByte(long offset,
byte value)
MemoryIOpublic final void putShort(long offset,
short value)
MemoryIOpublic final void putInt(long offset,
int value)
MemoryIOpublic final void putLong(long offset,
long value)
MemoryIOpublic final void putNativeLong(long offset,
long value)
MemoryIOputNativeLong in interface MemoryIOoffset - The offset within the memory area to write the value.value - The native long integer value to write to the memory location.public final void putAddress(long offset,
long value)
MemoryIOputAddress in interface MemoryIOoffset - The offset within the memory area to write the value.value - The pointer value to write to the memory location.public final void putFloat(long offset,
float value)
MemoryIOpublic final void putDouble(long offset,
double value)
MemoryIOpublic final void putMemoryIO(long offset,
MemoryIO value)
MemoryIOputMemoryIO in interface MemoryIOoffset - The offset within the memory area to write the value.value - The pointer value to write to the memory location.public final void get(long offset,
byte[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
byte[] src,
int off,
int len)
MemoryIOpublic final void get(long offset,
short[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
short[] src,
int off,
int len)
MemoryIOpublic final void get(long offset,
int[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
int[] src,
int off,
int len)
MemoryIOpublic final void get(long offset,
long[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
long[] src,
int off,
int len)
MemoryIOpublic final void get(long offset,
float[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
float[] src,
int off,
int len)
MemoryIOpublic final void get(long offset,
double[] dst,
int off,
int len)
MemoryIOpublic final void put(long offset,
double[] src,
int off,
int len)
MemoryIOpublic final int indexOf(long offset,
byte value)
MemoryIOpublic final int indexOf(long offset,
byte value,
int maxlen)
MemoryIOpublic final void setMemory(long offset,
long size,
byte value)
MemoryIOpublic final byte[] getZeroTerminatedByteArray(long offset)
MemoryIOgetZeroTerminatedByteArray in interface MemoryIOoffset - The offset within the memory area of the start of the string.public final byte[] getZeroTerminatedByteArray(long offset,
int maxlen)
MemoryIOgetZeroTerminatedByteArray in interface MemoryIOoffset - The offset within the memory area of the start of the string.maxlen - The maximum length to search for the zero byte terminator.public void putZeroTerminatedByteArray(long offset,
byte[] bytes,
int off,
int len)
MemoryIOputZeroTerminatedByteArray in interface MemoryIOoffset - The offset within the memory area of the start of the string.bytes - The byte array to write to the memory.off - The offset with the byte array to start copying.Copyright © 2002-2009 JRuby Team. All Rights Reserved.