Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://aoindustries.com/contact
public class PersistentCollections extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
ensureZeros(ByteBuffer byteBuffer,
int position,
int count)
Stores the requested number of zeros to the provided ByteBuffer, but
only if they do not already contain zeros.
|
static boolean |
ensureZeros(RandomAccessFile raf,
long position,
long count)
Writes the requested number of zeros to the provided RandomAccessFile, but
only if they do not already contain zeros.
|
static PersistentBlockBuffer |
getPersistentBlockBuffer(Serializer<?> serializer,
PersistentBuffer pbuffer,
long additionalBlockSpace)
Gets the most efficient
PersistentBlockBuffer for the provided
provided Serializer. |
static PersistentBuffer |
getPersistentBuffer(long maximumCapacity)
Selects the most efficient temporary
PersistentBuffer for the current
machine and the provided maximum buffer size. |
static PersistentBuffer |
getPersistentBuffer(RandomAccessFile raf,
ProtectionLevel protectionLevel,
long maximumCapacity)
Selects the most efficient
PersistentBuffer for the current
machine and the provided maximum buffer size. |
static <E> Serializer<E> |
getSerializer(Class<E> type)
Selects the most efficient
Serializer for the provided class. |
public static boolean ensureZeros(RandomAccessFile raf, long position, long count) throws IOException
IOExceptionpublic static boolean ensureZeros(ByteBuffer byteBuffer, int position, int count) throws IOException
IOExceptionpublic static PersistentBuffer getPersistentBuffer(long maximumCapacity) throws IOException
PersistentBuffer for the current
machine and the provided maximum buffer size. The buffer will be backed by a temporary
file that will be deleted on buffer close or JVM shutdown. The protection level will be
NONE. The order of preference is:
MappedPersistentBufferLargeMappedPersistentBufferRandomAccessFileBuffermaximumCapacity - The maximum size of data that may be stored in the
buffer. To ensure no limits, use Long.MAX_VALUE.IOExceptionpublic static PersistentBuffer getPersistentBuffer(RandomAccessFile raf, ProtectionLevel protectionLevel, long maximumCapacity) throws IOException
PersistentBuffer for the current
machine and the provided maximum buffer size. The order of preference is:
MappedPersistentBufferLargeMappedPersistentBufferRandomAccessFileBuffermaximumCapacity - The maximum size of data that may be stored in the
buffer. If the random access file is larger than this value,
the length of the file is used instead.
To ensure no limits, use Long.MAX_VALUE.IOExceptionpublic static <E> Serializer<E> getSerializer(Class<E> type)
Serializer for the provided class.public static PersistentBlockBuffer getPersistentBlockBuffer(Serializer<?> serializer, PersistentBuffer pbuffer, long additionalBlockSpace) throws IOException
PersistentBlockBuffer for the provided
provided Serializer. If using fixed record sizes, the size of
the block buffer is rounded up to the nearest power of two, to help
alignment with system page tables.serializer - The Serializer that will be used to write to the blockspbuffer - The PersistenceBuffer that will be wrapped by the block bufferadditionalBlockSpace - The maximum additional space needed beyond the space used by the serializer. This may be used
for linked list pointers, for example.IOExceptionCopyright © 2000–2019 AO Industries, Inc.. All rights reserved.