public class MappedBuffer extends ByteBufferBuffer
ByteBuffer based buffer.| Modifier and Type | Method and Description |
|---|---|
static MappedBuffer |
allocate(File file)
Allocates a dynamic capacity mapped buffer in
FileChannel.MapMode#READ_WRITE mode with an initial capacity
of 16MiB and a maximum capacity of Integer.MAX_VALUE. |
static MappedBuffer |
allocate(File file,
FileChannel.MapMode mode)
Allocates a dynamic capacity mapped buffer in
FileChannel.MapMode#READ_WRITE mode with an initial capacity
of 16MiB and a maximum capacity of Integer.MAX_VALUE. |
static MappedBuffer |
allocate(File file,
FileChannel.MapMode mode,
int capacity)
Allocates a fixed capacity mapped buffer in the given
FileChannel.MapMode. |
static MappedBuffer |
allocate(File file,
FileChannel.MapMode mode,
int initialCapacity,
int maxCapacity)
Allocates a mapped buffer.
|
static MappedBuffer |
allocate(File file,
int capacity)
Allocates a fixed capacity mapped buffer in
FileChannel.MapMode#READ_WRITE mode. |
static MappedBuffer |
allocate(File file,
int initialCapacity,
int maxCapacity)
Allocates a mapped buffer.
|
void |
delete()
Deletes the underlying file.
|
MappedBuffer |
duplicate()
Returns a duplicate of the buffer.
|
arrayacquire, asReadOnlyBuffer, bytes, capacity, capacity, clear, close, compact, flip, flush, hasRemaining, isDirect, isFile, isReadOnly, limit, limit, mark, maxCapacity, offset, order, order, position, position, read, read, read, read, read, read, read, readBoolean, readBoolean, readByte, readByte, readChar, readChar, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLong, readLong, readMedium, readMedium, readShort, readShort, readString, readString, readString, readString, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedMedium, readUnsignedMedium, readUnsignedShort, readUnsignedShort, readUTF8, readUTF8, references, release, remaining, reset, rewind, skip, slice, slice, slice, write, write, write, write, write, write, write, writeBoolean, writeBoolean, writeByte, writeByte, writeChar, writeChar, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeLong, writeLong, writeMedium, writeMedium, writeShort, writeShort, writeString, writeString, writeString, writeString, writeUnsignedByte, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt, writeUnsignedMedium, writeUnsignedMedium, writeUnsignedShort, writeUnsignedShort, writeUTF8, writeUTF8, zero, zero, zeroequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadByteswriteBytespublic static MappedBuffer allocate(File file)
FileChannel.MapMode#READ_WRITE mode with an initial capacity
of 16MiB and a maximum capacity of Integer.MAX_VALUE.
The resulting buffer will have a maximum capacity of Integer.MAX_VALUE. As bytes are written to the buffer
its capacity will double in count each time the current capacity is reached. Memory will be mapped by opening and
expanding the given File to the desired capacity and mapping the file contents into memory via
FileChannel.map(FileChannel.MapMode, long, long).
file - The file to map into memory.NullPointerException - If file is nullallocate(File, FileChannel.MapMode),
allocate(File, int),
allocate(File, FileChannel.MapMode, int),
allocate(File, int, int),
allocate(File, FileChannel.MapMode, int, int)public static MappedBuffer allocate(File file, FileChannel.MapMode mode)
FileChannel.MapMode#READ_WRITE mode with an initial capacity
of 16MiB and a maximum capacity of Integer.MAX_VALUE.
The resulting buffer will be initialized to a capacity of 4096 and have a maximum capacity of
Integer.MAX_VALUE. As bytes are written to the buffer its capacity will double in count each time the current
capacity is reached. Memory will be mapped by opening and expanding the given File to the desired
capacity and mapping the file contents into memory via
FileChannel.map(FileChannel.MapMode, long, long).
file - The file to map into memory.mode - The mode with which to map the file.NullPointerException - If file is nullallocate(File),
allocate(File, int),
allocate(File, FileChannel.MapMode, int),
allocate(File, int, int),
allocate(File, FileChannel.MapMode, int, int)public static MappedBuffer allocate(File file, int capacity)
FileChannel.MapMode#READ_WRITE mode.
Memory will be mapped by opening and expanding the given File to the desired capacity and mapping the
file contents into memory via FileChannel.map(FileChannel.MapMode, long, long).
The resulting buffer will have a capacity of capacity. The underlying UnsafeMappedBytes will be
initialized to the next power of 2.
file - The file to map into memory.capacity - The fixed capacity of the buffer to allocate (in bytes).NullPointerException - If file is nullIllegalArgumentException - If the capacity is greater than Integer.MAX_VALUE.allocate(File),
allocate(File, FileChannel.MapMode),
allocate(File, FileChannel.MapMode, int),
allocate(File, int, int),
allocate(File, FileChannel.MapMode, int, int)public static MappedBuffer allocate(File file, FileChannel.MapMode mode, int capacity)
FileChannel.MapMode.
Memory will be mapped by opening and expanding the given File to the desired capacity and mapping the
file contents into memory via FileChannel.map(FileChannel.MapMode, long, long).
The resulting buffer will have a capacity of capacity. The underlying UnsafeMappedBytes will be
initialized to the next power of 2.
file - The file to map into memory.mode - The mode with which to map the file.capacity - The fixed capacity of the buffer to allocate (in bytes).NullPointerException - If file is nullIllegalArgumentException - If the capacity is greater than Integer.MAX_VALUE.allocate(File),
allocate(File, FileChannel.MapMode),
allocate(File, int),
allocate(File, int, int),
allocate(File, FileChannel.MapMode, int, int)public static MappedBuffer allocate(File file, int initialCapacity, int maxCapacity)
Memory will be mapped by opening and expanding the given File to the desired count and mapping the
file contents into memory via FileChannel.map(FileChannel.MapMode, long, long).
The resulting buffer will have a capacity of initialCapacity. The underlying UnsafeMappedBytes will be
initialized to the next power of 2. As bytes are written to the buffer, the buffer's capacity will double
as int as maxCapacity > capacity.
file - The file to map into memory. If the file doesn't exist it will be automatically created.initialCapacity - The initial capacity of the buffer.maxCapacity - The maximum capacity of the buffer.NullPointerException - If file is nullIllegalArgumentException - If the capacity or maxCapacity is greater than
Integer.MAX_VALUE.allocate(File),
allocate(File, FileChannel.MapMode),
allocate(File, int),
allocate(File, FileChannel.MapMode, int),
allocate(File, FileChannel.MapMode, int, int)public static MappedBuffer allocate(File file, FileChannel.MapMode mode, int initialCapacity, int maxCapacity)
Memory will be mapped by opening and expanding the given File to the desired count and mapping the
file contents into memory via FileChannel.map(FileChannel.MapMode, long, long).
The resulting buffer will have a capacity of initialCapacity. The underlying UnsafeMappedBytes will be
initialized to the next power of 2. As bytes are written to the buffer, the buffer's capacity will double
as int as maxCapacity > capacity.
file - The file to map into memory. If the file doesn't exist it will be automatically created.mode - The mode with which to map the file.initialCapacity - The initial capacity of the buffer.maxCapacity - The maximum capacity of the buffer.NullPointerException - If file is nullIllegalArgumentException - If the capacity or maxCapacity is greater than
Integer.MAX_VALUE.allocate(File),
allocate(File, FileChannel.MapMode),
allocate(File, int),
allocate(File, FileChannel.MapMode, int),
allocate(File, int, int)public MappedBuffer duplicate()
Bufferpublic void delete()
Copyright © 2013–2018. All rights reserved.