Top Description Fields Constructors Methods
org.hsqldb.persist

pack-priv final Class RAFileNIO

extends Object
implements RandomAccessInterface
Class Inheritance
All Implemented Interfaces
org.hsqldb.persist.RandomAccessInterface
Imports
java.io.FileDescriptor, .IOException, .RandomAccessFile, java.nio.MappedByteBuffer, java.nio.channels.FileChannel, .FileChannel.MapMode, org.hsqldb.Database, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.ArrayUtil, .EventLogInterface, org.hsqldb.lib.java.JavaSystem

NIO version of ScaledRAFile. This class is used only for storing a CACHED TABLE .data file and cannot be used for TEXT TABLE source files. Once the maximum data file size allowed for NIO is reached, an ordinary ScaledRAFile is used for data access.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.8.0.5
Version
2.7.0

Field Summary

Modifier and TypeField and Description
private MappedByteBuffer
private int
private long
private MappedByteBuffer[]
private boolean
private FileChannel
private long
private RandomAccessFile
private FileDescriptor
private long
private static final String
pack-priv static final long
pack-priv static final int
pack-priv static final int
private final EventLogInterface
private final long
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
RAFileNIO(EventLogInterface logger, String name, boolean readOnly, long requiredLength, long maxLength)

Method Summary

Modifier and TypeMethod and Description
private void
checkBuffer()

checks for two types of potential errors before reads and writes and fixes them.

public void
private boolean
enlargeFile(long newFileLength)

public boolean
public Database
public long
public boolean
public long
private void
positionBufferMove(int relOffset)

private void
positionBufferSeek(long offset)

public int
public void
read(byte[] b, int offset, int length)

Implements org.hsqldb.persist.RandomAccessInterface.read.

public int
public long
public void
private void
setCurrentBuffer(long offset)

public boolean
public void
public void
write(byte[] b, int offset, int length)

Implements org.hsqldb.persist.RandomAccessInterface.write.

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private MappedByteBuffer buffer
bufferLengthback to summary
private int bufferLength
bufferPositionback to summary
private long bufferPosition
buffersback to summary
private MappedByteBuffer[] buffers
buffersModifiedback to summary
private boolean buffersModified
channelback to summary
private FileChannel channel
currentPositionback to summary
private long currentPosition
fileback to summary
private RandomAccessFile file
fileDescriptorback to summary
private FileDescriptor fileDescriptor
fileLengthback to summary
private long fileLength
JVM_ERRORback to summary
private static final String JVM_ERROR
largeBufferMaskback to summary
pack-priv static final long largeBufferMask
largeBufferScaleback to summary
pack-priv static final int largeBufferScale
largeBufferSizeback to summary
pack-priv static final int largeBufferSize
loggerback to summary
private final EventLogInterface logger
maxLengthback to summary
private final long maxLength
readOnlyback to summary
private final boolean readOnly

Constructor Detail

RAFileNIOback to summary
pack-priv RAFileNIO(EventLogInterface logger, String name, boolean readOnly, long requiredLength, long maxLength) throws IOException

Method Detail

checkBufferback to summary
private void checkBuffer()

checks for two types of potential errors before reads and writes and fixes them.

closeback to summary
public void close() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.close.

enlargeFileback to summary
private boolean enlargeFile(long newFileLength)
ensureLengthback to summary
public boolean ensureLength(long newLength)

Implements org.hsqldb.persist.RandomAccessInterface.ensureLength.

getDatabaseback to summary
public Database getDatabase()
getFilePointerback to summary
public long getFilePointer() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.getFilePointer.

isReadOnlyback to summary
public boolean isReadOnly()

Implements org.hsqldb.persist.RandomAccessInterface.isReadOnly.

lengthback to summary
public long length() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.length.

positionBufferMoveback to summary
private void positionBufferMove(int relOffset)
positionBufferSeekback to summary
private void positionBufferSeek(long offset)
readback to summary
public int read() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.read.

readback to summary
public void read(byte[] b, int offset, int length) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.read.

readIntback to summary
public int readInt() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.readInt.

readLongback to summary
public long readLong() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.readLong.

seekback to summary
public void seek(long newPos) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.seek.

setCurrentBufferback to summary
private void setCurrentBuffer(long offset)
setLengthback to summary
public boolean setLength(long newLength)

Implements org.hsqldb.persist.RandomAccessInterface.setLength.

synchback to summary
public void synch()

Implements org.hsqldb.persist.RandomAccessInterface.synch.

writeback to summary
public void write(byte[] b, int offset, int length) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.write.

writeIntback to summary
public void writeInt(int i) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.writeInt.

writeLongback to summary
public void writeLong(long i) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.writeLong.