public class InMemoryRandomAccessFile extends RandomAccessFile
Modifier and Type | Class and Description |
---|---|
static class |
InMemoryRandomAccessFile.Provider
Hook for service provider interface RandomAccessFileProvider
|
BIG_ENDIAN, LITTLE_ENDIAN
Constructor and Description |
---|
InMemoryRandomAccessFile(String name,
byte[] data)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
length()
Get the length of the file.
|
long |
readToByteChannel(WritableByteChannel dest,
long offset,
long nbytes)
Read
nbytes bytes, at the specified file offset, send to a WritableByteChannel. |
void |
setBufferSize(int bufferSize)
Set the buffer size.
|
acquire, acquire, close, eject, enableDefaultGlobalFileCache, flush, getBufferSize, getFilePointer, getGlobalFileCache, getLastModified, getLocation, getRandomAccessFile, isAtEndOfFile, isDirectory, order, order, read, read, read, readBoolean, readByte, readBytes, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLine, readLong, readLong, readShort, readShort, readString, readString, readStringMax, readStringMax, readUnsignedByte, readUnsignedShort, readUTF, searchForward, seek, setExtendMode, setGlobalFileCache, setMinLength, shutdown, skipBytes, skipBytes, toString, unread, write, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeChar, writeChar, writeChar, writeChar, writeChar, writeChar, writeChars, writeChars, writeChars, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeInt, writeInt, writeInt, writeInt, writeInt, writeInt, writeLong, writeLong, writeLong, writeLong, writeLong, writeLong, writeShort, writeShort, writeShort, writeShort, writeShort, writeShort, writeUTF
public InMemoryRandomAccessFile(String name, byte[] data)
name
- used as the locationdata
- the complete data filepublic long length()
RandomAccessFile
length
in class RandomAccessFile
public long readToByteChannel(WritableByteChannel dest, long offset, long nbytes) throws IOException
RandomAccessFile
nbytes
bytes, at the specified file offset, send to a WritableByteChannel.
This will block until all bytes are read.
This uses the underlying file channel directly, bypassing all user buffers.readToByteChannel
in class RandomAccessFile
dest
- write to this WritableByteChannel.offset
- the offset in the file where copying will start.nbytes
- the number of bytes to read.IOException
- if an I/O error occurs.public void setBufferSize(int bufferSize)
RandomAccessFile
setBufferSize
in class RandomAccessFile
bufferSize
- length in bytes