public class HostMemoryBuffer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected long |
address |
protected boolean |
closed |
protected long |
length |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addressOutOfBoundsCheck(long address,
long size,
String type) |
static HostMemoryBuffer |
allocate(long bytes)
Factory method to create this buffer
|
void |
close()
Close this buffer and free memory
|
void |
copyFromHostBuffer(long destOffset,
HostMemoryBuffer srcData,
long srcOffset,
long length)
Copy the contents of the given buffer to this buffer
|
protected void |
doClose()
Actually close the buffer.
|
byte |
getByte(long offset)
Returns the byte value at that offset
|
void |
getBytes(byte[] dst,
long dstOffset,
long srcOffset,
long len)
Copy a set of bytes to an array from the buffer starting at offset.
|
long |
getLength()
Returns the size of this buffer
|
void |
setByte(long offset,
byte value)
Sets the byte value at that offset
|
void |
setBytes(long offset,
byte[] data,
long srcOffset,
long len)
Copy a set of bytes from an array into the buffer at offset.
|
String |
toString() |
protected final long address
protected final long length
protected boolean closed
public static HostMemoryBuffer allocate(long bytes)
bytes - - size in bytes to allocatepublic final void copyFromHostBuffer(long destOffset,
HostMemoryBuffer srcData,
long srcOffset,
long length)
destOffset - offset in bytes in this buffer to start copying tosrcData - Buffer to be copied fromsrcOffset - offset in bytes to start copying from in srcDatalength - number of bytes to copypublic final byte getByte(long offset)
offset - - offset from the addresspublic final void setByte(long offset,
byte value)
offset - - offset from the addressvalue - - value to be setpublic final void getBytes(byte[] dst,
long dstOffset,
long srcOffset,
long len)
dstOffset - the offset from the address to start copying todst - the data to be copied.public final void setBytes(long offset,
byte[] data,
long srcOffset,
long len)
offset - the offset from the address to start copying todata - the data to be copied.protected void doClose()
public long getLength()
protected final void addressOutOfBoundsCheck(long address,
long size,
String type)
public final void close()
close in interface AutoCloseableCopyright © 2019. All rights reserved.