Package org.ujmp.core.util.io
Class WeakMappedByteBuffer
- java.lang.Object
-
- org.ujmp.core.util.io.WeakMappedByteBuffer
-
public class WeakMappedByteBuffer extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.WeakReference<java.nio.ByteBuffer>
byteBufferReference
static int
DEFAULTBUFFERSIZE
private java.nio.channels.FileChannel
fileChannel
private java.nio.channels.FileChannel.MapMode
mapMode
private long
pos
private long
size
-
Constructor Summary
Constructors Constructor Description WeakMappedByteBuffer(java.nio.channels.FileChannel fileChannel, java.nio.channels.FileChannel.MapMode mapMode, long pos, int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.CharBuffer
asCharBuffer()
java.nio.DoubleBuffer
asDoubleBuffer()
java.nio.FloatBuffer
asFloatBuffer()
java.nio.IntBuffer
asIntBuffer()
java.nio.LongBuffer
asLongBuffer()
java.nio.ByteBuffer
asReadOnlyBuffer()
java.nio.ShortBuffer
asShortBuffer()
long
capacity()
java.nio.ByteBuffer
compact()
static WeakMappedByteBuffer[]
create(java.io.RandomAccessFile randomAccessFile)
java.nio.ByteBuffer
duplicate()
byte
get()
void
get(byte[] dst, int offset, int length)
byte
get(int index)
char
getChar()
char
getChar(int index)
double
getDouble()
double
getDouble(int index)
float
getFloat()
float
getFloat(int index)
int
getInt()
int
getInt(int index)
long
getLong()
long
getLong(int index)
java.nio.ByteBuffer
getOrCreateByteBuffer()
short
getShort()
short
getShort(int index)
boolean
isDirect()
boolean
isReadOnly()
void
position(int offset)
java.nio.ByteBuffer
put(byte b)
void
put(byte[] bytes, int offset, int length)
java.nio.ByteBuffer
put(int index, byte b)
java.nio.ByteBuffer
putChar(char value)
java.nio.ByteBuffer
putChar(int index, char value)
java.nio.ByteBuffer
putDouble(double value)
java.nio.ByteBuffer
putDouble(int index, double value)
java.nio.ByteBuffer
putFloat(float value)
java.nio.ByteBuffer
putFloat(int index, float value)
java.nio.ByteBuffer
putInt(int value)
java.nio.ByteBuffer
putInt(int index, int value)
java.nio.ByteBuffer
putLong(int index, long value)
java.nio.ByteBuffer
putLong(long value)
java.nio.ByteBuffer
putShort(int index, short value)
java.nio.ByteBuffer
putShort(short value)
java.nio.Buffer
reset()
java.nio.Buffer
rewind()
java.nio.ByteBuffer
slice()
-
-
-
Field Detail
-
DEFAULTBUFFERSIZE
public static final int DEFAULTBUFFERSIZE
- See Also:
- Constant Field Values
-
byteBufferReference
private java.lang.ref.WeakReference<java.nio.ByteBuffer> byteBufferReference
-
fileChannel
private final java.nio.channels.FileChannel fileChannel
-
mapMode
private final java.nio.channels.FileChannel.MapMode mapMode
-
pos
private final long pos
-
size
private final long size
-
-
Method Detail
-
create
public static final WeakMappedByteBuffer[] create(java.io.RandomAccessFile randomAccessFile) throws java.io.IOException
- Throws:
java.io.IOException
-
getOrCreateByteBuffer
public java.nio.ByteBuffer getOrCreateByteBuffer()
-
slice
public java.nio.ByteBuffer slice()
-
duplicate
public java.nio.ByteBuffer duplicate()
-
asReadOnlyBuffer
public java.nio.ByteBuffer asReadOnlyBuffer()
-
get
public byte get()
-
put
public java.nio.ByteBuffer put(byte b)
-
get
public byte get(int index)
-
put
public java.nio.ByteBuffer put(int index, byte b)
-
compact
public java.nio.ByteBuffer compact()
-
isDirect
public boolean isDirect()
-
getChar
public char getChar()
-
putChar
public java.nio.ByteBuffer putChar(char value)
-
getChar
public char getChar(int index)
-
putChar
public java.nio.ByteBuffer putChar(int index, char value)
-
asCharBuffer
public java.nio.CharBuffer asCharBuffer()
-
getShort
public short getShort()
-
putShort
public java.nio.ByteBuffer putShort(short value)
-
getShort
public short getShort(int index)
-
putShort
public java.nio.ByteBuffer putShort(int index, short value)
-
asShortBuffer
public java.nio.ShortBuffer asShortBuffer()
-
getInt
public int getInt()
-
putInt
public java.nio.ByteBuffer putInt(int value)
-
getInt
public int getInt(int index)
-
putInt
public java.nio.ByteBuffer putInt(int index, int value)
-
asIntBuffer
public java.nio.IntBuffer asIntBuffer()
-
getLong
public long getLong()
-
putLong
public java.nio.ByteBuffer putLong(long value)
-
getLong
public long getLong(int index)
-
putLong
public java.nio.ByteBuffer putLong(int index, long value)
-
asLongBuffer
public java.nio.LongBuffer asLongBuffer()
-
getFloat
public float getFloat()
-
putFloat
public java.nio.ByteBuffer putFloat(float value)
-
getFloat
public float getFloat(int index)
-
putFloat
public java.nio.ByteBuffer putFloat(int index, float value)
-
asFloatBuffer
public java.nio.FloatBuffer asFloatBuffer()
-
getDouble
public double getDouble()
-
putDouble
public java.nio.ByteBuffer putDouble(double value)
-
getDouble
public double getDouble(int index)
-
putDouble
public java.nio.ByteBuffer putDouble(int index, double value)
-
asDoubleBuffer
public java.nio.DoubleBuffer asDoubleBuffer()
-
isReadOnly
public boolean isReadOnly()
-
capacity
public long capacity()
-
position
public void position(int offset)
-
put
public void put(byte[] bytes, int offset, int length)
-
get
public void get(byte[] dst, int offset, int length)
-
rewind
public java.nio.Buffer rewind()
-
reset
public java.nio.Buffer reset()
-
-