public class MMapRandomAccessFile extends RandomAccessFile
allFiles, BIG_ENDIAN, bigEndian, buffer, bufferStart, dataEnd, dataSize, debugAccess, debugLeaks, defaultBufferSize, endOfFile, file, fileChannel, filePosition, LITTLE_ENDIAN, location, openFiles, readonly, showOpen, showRead
Constructor and Description |
---|
MMapRandomAccessFile(java.lang.String location,
java.lang.String mode)
Constructor for in-memory "files"
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Copy the contents of the buffer to the disk.
|
long |
length()
Get the length of the file.
|
int |
read()
Read a byte of data from the file, blocking until data is
available.
|
protected int |
readBytes(byte[] dst,
int offset,
int length)
Read up to
len bytes into an array, at a specified
offset. |
void |
seek(long pos)
Set the position in the file for the next read or write.
|
void |
unread()
Unread the last byte read.
|
void |
write(int b)
Write a byte to the file.
|
void |
writeBytes(byte[] dst,
int offset,
int length)
Write
len bytes from an array to the file. |
acquire, acquire, close, eject, enableDefaultGlobalFileCache, getAllFiles, getBufferSize, getDebugLeaks, getDebugNbytes, getDebugNseeks, getFilePointer, getGlobalFileCache, getLastModified, getLocation, getMaxOpenFileCount, getOpenFileCount, getOpenFiles, getRandomAccessFile, isAtEndOfFile, order, order, reacquire, read_, read, read, readBoolean, readBuffer, readByte, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLong, readLong, readShort, readShort, readString, readStringMax, readToByteChannel, readUnsignedByte, readUnsignedShort, readUTF, release, searchForward, setBufferSize, setDebugAccess, setDebugLeaks, setExtendMode, setFileCache, setGlobalFileCache, setMinLength, shutdown, skipBytes, skipBytes, toString, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeChar, writeChar, writeChars, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeLong, writeLong, writeShort, writeShort, writeUTF
public MMapRandomAccessFile(java.lang.String location, java.lang.String mode) throws java.io.IOException
location
- used as a namemode
- the open modejava.io.IOException
- on errorpublic void flush() throws java.io.IOException
RandomAccessFile
flush
in class RandomAccessFile
java.io.IOException
- if an I/O error occurs.public long length()
RandomAccessFile
length
in class RandomAccessFile
public void seek(long pos)
RandomAccessFile
seek
in class RandomAccessFile
pos
- the offset (in bytes) from the start of the file.public void unread()
RandomAccessFile
unread
in class RandomAccessFile
public int read() throws java.io.IOException
RandomAccessFile
read
in class RandomAccessFile
java.io.IOException
- if an I/O error occurrs.protected int readBytes(byte[] dst, int offset, int length) throws java.io.IOException
RandomAccessFile
len
bytes into an array, at a specified
offset. This will block until at least one byte has been read.readBytes
in class RandomAccessFile
dst
- the byte array to receive the bytes.offset
- the offset in the array where copying will start.length
- the number of bytes to copy.java.io.IOException
- if an I/O error occurrs.public void write(int b) throws java.io.IOException
RandomAccessFile
write
in interface java.io.DataOutput
write
in class RandomAccessFile
b
- write this bytejava.io.IOException
- if an I/O error occurrs.public void writeBytes(byte[] dst, int offset, int length) throws java.io.IOException
RandomAccessFile
len
bytes from an array to the file.writeBytes
in class RandomAccessFile
dst
- the array containing the data.offset
- the offset in the array to the data.length
- the length of the data.java.io.IOException
- if an I/O error occurrs.