Top Inners Fields Constructors Methods
org.jruby.ext.ffi

public final Class ArrayMemoryIO

extends MemoryIO
Class Inheritance
Imports
java.nio.ByteOrder, java.util.Arrays, org.jruby.Ruby

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract static class
private static class
private static class
private abstract static class
private static class
private static class
private abstract static class

Field Summary

Modifier and TypeField and Description
protected static final int
protected final byte[]
protected static final ArrayMemoryIO.ArrayIO
protected final int
protected static final int
protected final int
protected final Ruby
Inherited from org.jruby.ext.ffi.MemoryIO:
addressisDirect

Constructor Summary

AccessConstructor and Description
public
ArrayMemoryIO(Ruby runtime, byte[] buffer, int offset, int length)

public
ArrayMemoryIO(Ruby runtime, int size)

Method Summary

Modifier and TypeMethod and Description
public final byte[]
public final int
public final int
public ByteBuffer
asByteBuffer()

Implements abstract org.jruby.ext.ffi.MemoryIO.asByteBuffer.

Creates a view of this memory object as a java NIO byte buffer.

private final void
checkBounds(long off, long len)

public final void
public ArrayMemoryIO
dup()

Implements abstract org.jruby.ext.ffi.MemoryIO.dup.

Duplicates this MemoryIO, including its contents.

public final void
get(long
The offset within the memory area to read the bytes.
offset
,
byte[]
The output byte array to place the data.
dst
,
int
The offset within the byte array to start copying.
off
,
int
The length of data to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of bytes from the memory area at the specified offset.

public final void
get(long
The offset within the memory area to read the shorts.
offset
,
short[]
The output array to place the data in.
dst
,
int
The offset within the array to start copying.
off
,
int
The number of shorts to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of shorts from the memory area at the specified offset.

public final void
get(long
The offset within the memory area to read the ints.
offset
,
int[]
The output array to place the data in.
dst
,
int
The offset within the array to start copying.
off
,
int
The number of ints to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of ints from the memory area at the specified offset.

public final void
get(long
The offset within the memory area to read the longs.
offset
,
long[]
The output array to place the data in.
dst
,
int
The offset within the array to start copying.
off
,
int
The number of longs to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of longs from the memory area at the specified offset.

public final void
get(long
The offset within the memory area to read the floats.
offset
,
float[]
The output array to place the data in.
dst
,
int
The offset within the array to start copying.
off
,
int
The number of floats to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of floats from the memory area at the specified offset.

public final void
get(long
The offset within the memory area to read the doubles.
offset
,
double[]
The output array to place the data in.
dst
,
int
The offset within the array to start copying.
off
,
int
The number of doubles to read.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.get.

Reads an array of doubles from the memory area at the specified offset.

public final long
getAddress(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getAddress.

Reads a pointer value at the specified offset within the memory area.

private static final ArrayMemoryIO.ArrayIO
public final byte
getByte(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getByte.

Reads an 8 bit integer value from the memory area.

public final double
getDouble(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getDouble.

Reads a double value from the memory area.

public final float
getFloat(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getFloat.

Reads a float value from the memory area.

public final int
getInt(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getInt.

Reads a 32 bit integer value from the memory area.

public final long
getLong(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getLong.

Reads a 64 bit integer value from the memory area.

public final MemoryIO
getMemoryIO(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getMemoryIO.

Reads a pointer value at the specified offset within the memory area, and wraps it in an abstract memory accessor.

public final long
getNativeLong(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getNativeLong.

Reads a native long integer value from the memory area.

public final short
getShort(long
The offset within the memory area to read the value.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getShort.

Reads a 16 bit integer value from the memory area.

public final byte[]
getZeroTerminatedByteArray(long
The offset within the memory area of the start of the string.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getZeroTerminatedByteArray.

Reads a zero terminated byte array (e.g. an ascii or utf-8 string)

public final byte[]
getZeroTerminatedByteArray(long
The offset within the memory area of the start of the string.
offset
,
int
The maximum length to search for the zero byte terminator.
maxlen
)

Implements abstract org.jruby.ext.ffi.MemoryIO.getZeroTerminatedByteArray.

Reads a zero terminated byte array (e.g. an ascii or utf-8 string)

protected final int
index(long off)

public final int
indexOf(long
The offset within the memory area to start searching.
offset
,
byte
The value to search for.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.indexOf.

Gets the first index within the memory area of a particular 8 bit value.

public final int
indexOf(long
The offset within the memory area to start searching.
offset
,
byte
The value to search for.
value
,
int maxlen)

Implements abstract org.jruby.ext.ffi.MemoryIO.indexOf.

Gets the first index within the memory area of a particular 8 bit value.

private static final ArrayMemoryIO.ArrayIO
private static final ArrayMemoryIO.ArrayIO
private static final ArrayMemoryIO.ArrayIO
private static final ArrayMemoryIO.ArrayIO
public final ByteOrder
order()

Implements abstract org.jruby.ext.ffi.MemoryIO.order.

Gets the ByteOrder this MemoryIO instance will read/write values to memory in.

public final void
put(long
The offset within the memory area to start writing the bytes.
offset
,
byte[]
The byte array to write to the memory area.
src
,
int
The offset within the byte array to start copying.
off
,
int
The length of data to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of bytes to the memory area at the specified offset.

public final void
put(long
The offset within the memory area to start writing the shorts.
offset
,
short[]
The array to write to the memory area.
src
,
int
The offset within the array to start copying.
off
,
int
The number of shorts to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of shorts to the memory area at the specified offset.

public final void
put(long
The offset within the memory area to start writing the ints.
offset
,
int[]
The array to write to the memory area.
src
,
int
The offset within the array to start copying.
off
,
int
The number of ints to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of ints to the memory area at the specified offset.

public final void
put(long
The offset within the memory area to start writing the longs.
offset
,
long[]
The array to write to the memory area.
src
,
int
The offset within the array to start copying.
off
,
int
The number of longs to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of longs to the memory area at the specified offset.

public final void
put(long
The offset within the memory area to start writing the floats.
offset
,
float[]
The array to write to the memory area.
src
,
int
The offset within the array to start copying.
off
,
int
The number of floats to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of floats to the memory area at the specified offset.

public final void
put(long
The offset within the memory area to start writing the doubles.
offset
,
double[]
The array to write to the memory area.
src
,
int
The offset within the array to start copying.
off
,
int
The number of doubles to write.
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.put.

Writes an array of doubles to the memory area at the specified offset.

public final void
putAddress(long
The offset within the memory area to write the value.
offset
,
long
The pointer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putAddress.

Writes a pointer value to the memory area at the specified offset.

public final void
putByte(long
The offset within the memory area to write the value.
offset
,
byte
The 8 bit integer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putByte.

Writes an 8 bit integer value to the memory area at the specified offset.

public final void
putDouble(long
The offset within the memory area to write the value.
offset
,
double
The 64 bit float value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putDouble.

Writes a 64 bit float value to the memory area at the specified offset.

public final void
putFloat(long
The offset within the memory area to write the value.
offset
,
float
The 32 bit float value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putFloat.

Writes a 32 bit float value to the memory area at the specified offset.

public final void
putInt(long
The offset within the memory area to write the value.
offset
,
int
The 32 bit integer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putInt.

Writes a 32 bit integer value to the memory area at the specified offset.

public final void
putLong(long
The offset within the memory area to write the value.
offset
,
long
The 64 bit integer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putLong.

Writes a 64 bit integer value to the memory area at the specified offset.

public final void
putMemoryIO(long
The offset within the memory area to write the value.
offset
,
MemoryIO
The pointer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putMemoryIO.

Writes a pointer value to the memory area at the specified offset.

public final void
putNativeLong(long
The offset within the memory area to write the value.
offset
,
long
The native long integer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putNativeLong.

Writes a native long integer value to the memory area at the specified offset.

public final void
putShort(long
The offset within the memory area to write the value.
offset
,
short
The 16 bit integer value to write to the memory location.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putShort.

Writes a 16 bit integer value to the memory area at the specified offset.

public void
putZeroTerminatedByteArray(long
The offset within the memory area of the start of the string.
offset
,
byte[]
The byte array to write to the memory.
bytes
,
int
The offset with the byte array to start copying.
off
,
int
The number of bytes of the byte array to write to the memory area. (not including zero byte)
len
)

Implements abstract org.jruby.ext.ffi.MemoryIO.putZeroTerminatedByteArray.

Writes a byte array to memory, and appends a zero terminator

public final void
setMemory(long
The offset within the memory area to start writing.
offset
,
long
The number of bytes to set to the value.
size
,
byte
The value to set each byte to.
value
)

Implements abstract org.jruby.ext.ffi.MemoryIO.setMemory.

Sets the contents of the memory area to the value.

public ArrayMemoryIO
slice(long
The offset within the existing memory area to start the new MemoryIO at.
offset
)

Implements abstract org.jruby.ext.ffi.MemoryIO.slice.

Creates a new MemoryIO pointing to a subset of the memory area of this MemoryIO.

public ArrayMemoryIO
slice(long
The offset within the existing memory area to start the new MemoryIO at.
offset
,
long
The size of the new slice.
size
)

Implements abstract org.jruby.ext.ffi.MemoryIO.slice.

Creates a new MemoryIO pointing to a subset of the memory area of this MemoryIO.

Inherited from org.jruby.ext.ffi.MemoryIO:
addressisDirectisNull