public class DirectStore extends Object implements BytesStore, AutoCloseable
| Constructor and Description |
|---|
DirectStore(long size) |
DirectStore(ObjectSerializer objectSerializer,
long size,
boolean zeroOut) |
| Modifier and Type | Method and Description |
|---|---|
long |
address() |
static DirectStore |
allocate(long size) |
static DirectStore |
allocateLazy(long size) |
static BytesStore |
allocateLazy(long sizeInBytes,
ObjectSerializer objectSerializer) |
DirectBytes |
bytes()
Create a bytes whose content is the whole bytes store.
|
DirectBytes |
bytes(long offset,
long length)
|
void |
close()
calls free
|
File |
file() |
void |
free() |
ObjectSerializer |
objectSerializer() |
void |
resize(long newSize,
boolean zeroOut)
Resizes this
DirectStore to the newSize. |
long |
size() |
public DirectStore(long size)
public DirectStore(ObjectSerializer objectSerializer, long size, boolean zeroOut)
@NotNull public static DirectStore allocate(long size)
@NotNull public static DirectStore allocateLazy(long size)
public static BytesStore allocateLazy(long sizeInBytes, ObjectSerializer objectSerializer)
public ObjectSerializer objectSerializer()
objectSerializer in interface BytesStorepublic void resize(long newSize,
boolean zeroOut)
DirectStore to the newSize.
If zeroOut is false, the memory past the old size is not zeroed out and
will generally be garbage.
DirectStore don't keep track of the child DirectBytes instances, so after
the resize they might point to the wrong memory. Use at your own risk.
newSize - new size of this DirectStorezeroOut - if the memory past the old size should be zeroed out on increasing resizeIllegalArgumentException - if the newSize is not positive@NotNull public DirectBytes bytes()
BytesStorebytes(0, size()) call.bytes in interface BytesStoreBytesStore.bytes(long, long)@NotNull public DirectBytes bytes(long offset, long length)
BytesStoreBytes object with start address of
address+ offset and capacity of length.
If this BytesStore is Bytes itself rather than natural
BytesStore object, this method will offset the new bytes from the
bytes' start, not from bytes' position like
BytesCommon.slice(long, long).
offset should be non-negative, length should be positive,
offset + length should be less or equal to size.
bytes in interface BytesStoreoffset - offset of the new bytes from the bytes store addresslength - capacity and limit of the new bytesBytesBytesStore.bytes()public long address()
address in interface BytesStorepublic void free()
free in interface BytesStorepublic long size()
size in interface BytesStorepublic File file()
file in interface BytesStorepublic void close()
close in interface AutoCloseableCopyright © 2019. All rights reserved.