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://www.aoindustries.com/contact
public class PersistentCollections extends Object
| Modifier and Type | Method and Description |
|---|---|
static char |
bufferToChar(byte[] ioBuffer) |
static char |
bufferToChar(byte[] ioBuffer,
int off) |
static int |
bufferToInt(byte[] ioBuffer) |
static int |
bufferToInt(byte[] ioBuffer,
int off) |
static long |
bufferToLong(byte[] ioBuffer) |
static long |
bufferToLong(byte[] ioBuffer,
int off) |
static short |
bufferToShort(byte[] ioBuffer) |
static short |
bufferToShort(byte[] ioBuffer,
int off) |
static void |
charToBuffer(char ch,
byte[] ioBuffer) |
static void |
charToBuffer(char ch,
byte[] ioBuffer,
int off) |
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. |
static void |
intToBuffer(int i,
byte[] ioBuffer) |
static void |
intToBuffer(int i,
byte[] ioBuffer,
int off) |
static void |
longToBuffer(long l,
byte[] ioBuffer) |
static void |
longToBuffer(long l,
byte[] ioBuffer,
int off) |
static void |
shortToBuffer(short s,
byte[] ioBuffer) |
static void |
shortToBuffer(short s,
byte[] ioBuffer,
int off) |
public static void charToBuffer(char ch,
byte[] ioBuffer)
public static void charToBuffer(char ch,
byte[] ioBuffer,
int off)
public static char bufferToChar(byte[] ioBuffer)
public static char bufferToChar(byte[] ioBuffer,
int off)
public static void shortToBuffer(short s,
byte[] ioBuffer)
public static void shortToBuffer(short s,
byte[] ioBuffer,
int off)
public static short bufferToShort(byte[] ioBuffer)
public static short bufferToShort(byte[] ioBuffer,
int off)
public static void intToBuffer(int i,
byte[] ioBuffer)
public static void intToBuffer(int i,
byte[] ioBuffer,
int off)
public static int bufferToInt(byte[] ioBuffer)
public static int bufferToInt(byte[] ioBuffer,
int off)
public static void longToBuffer(long l,
byte[] ioBuffer)
public static void longToBuffer(long l,
byte[] ioBuffer,
int off)
public static long bufferToLong(byte[] ioBuffer)
public static long bufferToLong(byte[] ioBuffer,
int off)
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–2016 AO Industries, Inc.. All rights reserved.