public class MMapRandomAccessFile extends RandomAccessFile
BIG_ENDIAN, LITTLE_ENDIAN
Constructor and Description |
---|
MMapRandomAccessFile(String location,
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.
|
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, readBoolean, readByte, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLong, readLong, readShort, readShort, readString, readString, readStringMax, 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(String location, String mode) throws IOException
location
- used as a namemode
- the open modeIOException
- on errorpublic void flush()
RandomAccessFile
flush
in class RandomAccessFile
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()
RandomAccessFile
read
in class RandomAccessFile
public int readBytes(byte[] dst, int offset, int length)
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.public void write(int b)
RandomAccessFile
write
in interface DataOutput
write
in class RandomAccessFile
b
- write this bytepublic void writeBytes(byte[] dst, int offset, int length)
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.