public class LBufferAPI
extends java.lang.Object
| Constructor and Description |
|---|
LBufferAPI() |
LBufferAPI(Memory m) |
| Modifier and Type | Method and Description |
|---|---|
long |
address()
Address of the data part of the allocated memory
|
byte |
apply(int offset)
Read a byte at offset
|
byte |
apply(long offset)
Read a byte at offset
|
void |
clear()
Clear the buffer by filling with zeros
|
void |
copyTo(int srcOffset,
byte[] destArray,
int destOffset,
int size)
Copy the contents of this buffer begginning from the srcOffset to a destination byte array
|
void |
copyTo(long srcOffset,
LBufferAPI dest,
long destOffset,
long size)
Copy the contents of this buffer to the destination LBuffer
|
void |
fill(long offset,
long length,
byte value)
Fill the buffer of the specified range with a given value
|
byte |
getByte(int offset) |
byte |
getByte(long offset) |
char |
getChar(int offset) |
char |
getChar(long offset) |
double |
getDouble(int offset) |
double |
getDouble(long offset) |
float |
getFloat(int offset) |
float |
getFloat(long offset) |
int |
getInt(int offset) |
int |
getInt(long offset) |
long |
getLong(int offset) |
long |
getLong(long offset) |
short |
getShort(int offset) |
short |
getShort(long offset) |
static LBuffer |
loadFrom(java.io.File file)
Create an LBuffer from a given file.
|
protected long |
offset() |
void |
putByte(int offset,
byte value) |
void |
putByte(long offset,
byte value) |
void |
putChar(int offset,
char value) |
void |
putChar(long offset,
char value) |
void |
putDouble(int offset,
double value) |
void |
putDouble(long offset,
double value) |
void |
putFloat(int offset,
float value) |
void |
putFloat(long offset,
float value) |
void |
putInt(int offset,
int value) |
void |
putInt(long offset,
int value) |
void |
putLong(int offset,
long value) |
void |
putLong(long offset,
long value) |
void |
putShort(int offset,
short value) |
void |
putShort(long offset,
short value) |
int |
readFrom(byte[] src,
int srcOffset,
long destOffset,
int length)
Read the given source byte array, then overwrite this buffer's contents
|
int |
readFrom(byte[] src,
long destOffset)
Read the given source byte array, then overwrite this buffer's contents
|
int |
readFrom(java.nio.ByteBuffer src,
long destOffset)
Reads the given source byte buffer into this buffer at the given offset
|
void |
release()
Release the memory content.
|
long |
size()
Size of this buffer
|
LBuffer |
slice(long from,
long to)
Extract a slice [from, to) of this buffer.
|
byte[] |
toArray()
Convert this buffer to a java array.
|
java.nio.ByteBuffer |
toDirectByteBuffer(long offset,
int size)
Gives a ByteBuffer view of the specified range.
|
java.nio.ByteBuffer[] |
toDirectByteBuffers()
Gives an sequence of ByteBuffers.
|
java.nio.ByteBuffer[] |
toDirectByteBuffers(long offset,
long size)
Gives an sequence of ByteBuffers of a specified range.
|
void |
update(int offset,
byte value)
Set a byte at offset
|
void |
update(long offset,
byte value)
Set a byte at offset
|
WrappedLBuffer |
view(long from,
long to)
Create a view of the range [from, to) of this buffer.
|
void |
writeTo(java.io.File file)
Dump the buffer contents to a file
|
void |
writeTo(java.nio.channels.FileChannel channel)
Write the buffer contents to the given file channel.
|
void |
writeTo(java.nio.channels.GatheringByteChannel channel)
Writes the buffer contents to the given byte channel.
|
void |
writeTo(java.nio.channels.WritableByteChannel channel)
Writes the buffer contents to the given byte channel.
|
public Memory m
public LBufferAPI()
public LBufferAPI(Memory m)
public byte apply(int offset)
offset - public void update(int offset,
byte value)
offset - value - public byte apply(long offset)
offset - public void update(long offset,
byte value)
offset - value - public void release()
public long address()
public long size()
public void clear()
public void fill(long offset,
long length,
byte value)
offset - length - value - public byte getByte(int offset)
public char getChar(int offset)
public short getShort(int offset)
public int getInt(int offset)
public float getFloat(int offset)
public long getLong(int offset)
public double getDouble(int offset)
public void putByte(int offset,
byte value)
public void putChar(int offset,
char value)
public void putShort(int offset,
short value)
public void putInt(int offset,
int value)
public void putFloat(int offset,
float value)
public void putLong(int offset,
long value)
public void putDouble(int offset,
double value)
public byte getByte(long offset)
public char getChar(long offset)
public short getShort(long offset)
public int getInt(long offset)
public float getFloat(long offset)
public long getLong(long offset)
public double getDouble(long offset)
public void putByte(long offset,
byte value)
public void putChar(long offset,
char value)
public void putShort(long offset,
short value)
public void putInt(long offset,
int value)
public void putFloat(long offset,
float value)
public void putLong(long offset,
long value)
public void putDouble(long offset,
double value)
public void copyTo(int srcOffset,
byte[] destArray,
int destOffset,
int size)
srcOffset - destArray - destOffset - size - public void copyTo(long srcOffset,
LBufferAPI dest,
long destOffset,
long size)
srcOffset - dest - destOffset - size - public LBuffer slice(long from, long to)
from - to - public WrappedLBuffer view(long from, long to)
from - to - public byte[] toArray()
public void writeTo(java.nio.channels.FileChannel channel)
throws java.io.IOException
channel - java.io.IOExceptionpublic void writeTo(java.nio.channels.GatheringByteChannel channel)
throws java.io.IOException
channel - java.io.IOExceptionpublic void writeTo(java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
channel - java.io.IOExceptionpublic void writeTo(java.io.File file)
throws java.io.IOException
file - java.io.IOExceptionpublic int readFrom(byte[] src,
long destOffset)
src - source byte arraydestOffset - offset in this buffer to read topublic int readFrom(byte[] src,
int srcOffset,
long destOffset,
int length)
src - source byte arraysrcOffset - offset in source byte array to read fromdestOffset - offset in this buffer to read tolength - max number of bytes to readpublic int readFrom(java.nio.ByteBuffer src,
long destOffset)
src - source byte bufferdestOffset - offset in this buffer to read topublic static LBuffer loadFrom(java.io.File file) throws java.io.IOException
file - java.io.IOExceptionpublic java.nio.ByteBuffer[] toDirectByteBuffers()
public java.nio.ByteBuffer[] toDirectByteBuffers(long offset,
long size)
offset - size - public java.nio.ByteBuffer toDirectByteBuffer(long offset,
int size)
offset - size - protected long offset()