Top Description Fields Constructors Methods
org.hsqldb.persist

pack-priv final Class RAFile

extends Object
implements RandomAccessInterface
Class Inheritance
All Implemented Interfaces
org.hsqldb.persist.RandomAccessInterface
Imports
java.io.EOFException, .FileDescriptor, .FileNotFoundException, .IOException, .RandomAccessFile, org.hsqldb.Database, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.ArrayUtil, .EventLogInterface, .HsqlByteArrayInputStream, .HsqlByteArrayOutputStream

This class is a wrapper for a random access file such as that used for CACHED table storage.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.7.2
Version
2.7.0

Field Summary

Modifier and TypeField and Description
pack-priv final HsqlByteArrayInputStream
pack-priv final byte[]
pack-priv static final long
pack-priv long
pack-priv static final int
pack-priv static final int
pack-priv int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv final boolean
pack-priv final RandomAccessFile
pack-priv final FileDescriptor
pack-priv long
pack-priv final String
pack-priv final EventLogInterface
private final boolean
pack-priv long
pack-priv final byte[]
pack-priv final HsqlByteArrayInputStream
pack-priv final HsqlByteArrayOutputStream

Constructor Summary

AccessConstructor and Description
pack-priv
RAFile(EventLogInterface logger, String name, boolean readonly, boolean extendLengthToBlock, boolean commitOnChange)

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
private void
extendLength(long position)

Some old JVM's do not allow seek beyond end of file, so zeros must be written first in that case.

private long
getExtendLength(long position)

public long
public boolean
public long
pack-priv static RandomAccessInterface
newScaledRAFile(Database database, String name, boolean readonly, int type)

seekPosition is the position in seek() calls or after reading or writing realPosition is the file position

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

Implements org.hsqldb.persist.RandomAccessInterface.read.

public int
private void
public long
private void
public void
public boolean
public void
public void
write(byte[] b, int off, int length)

Implements org.hsqldb.persist.RandomAccessInterface.write.

public void
public void
private int
writeToBuffer(byte[] b, int off, int len)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baback to summary
pack-priv final HsqlByteArrayInputStream ba
bufferback to summary
pack-priv final byte[] buffer
bufferMaskback to summary
pack-priv static final long bufferMask
bufferOffsetback to summary
pack-priv long bufferOffset
bufferScaleback to summary
pack-priv static final int bufferScale
bufferSizeback to summary
pack-priv static final int bufferSize
cacheHitback to summary
pack-priv int cacheHit
DATA_FILE_JARback to summary
pack-priv static final int DATA_FILE_JAR
DATA_FILE_NIOback to summary
pack-priv static final int DATA_FILE_NIO
DATA_FILE_RAFback to summary
pack-priv static final int DATA_FILE_RAF
DATA_FILE_SINGLEback to summary
pack-priv static final int DATA_FILE_SINGLE
DATA_FILE_STOREDback to summary
pack-priv static final int DATA_FILE_STORED
DATA_FILE_TEXTback to summary
pack-priv static final int DATA_FILE_TEXT
extendLengthback to summary
pack-priv final boolean extendLength
fileback to summary
pack-priv final RandomAccessFile file
fileDescriptorback to summary
pack-priv final FileDescriptor fileDescriptor
fileLengthback to summary
pack-priv long fileLength
fileNameback to summary
pack-priv final String fileName
loggerback to summary
pack-priv final EventLogInterface logger
readOnlyback to summary
private final boolean readOnly
seekPositionback to summary
pack-priv long seekPosition
valueBufferback to summary
pack-priv final byte[] valueBuffer
vbaiback to summary
pack-priv final HsqlByteArrayInputStream vbai
vbaoback to summary
pack-priv final HsqlByteArrayOutputStream vbao

Constructor Detail

RAFileback to summary
pack-priv RAFile(EventLogInterface logger, String name, boolean readonly, boolean extendLengthToBlock, boolean commitOnChange) throws IOException

Method Detail

closeback to summary
public void close() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.close.

ensureLengthback to summary
public boolean ensureLength(long newLength)

Implements org.hsqldb.persist.RandomAccessInterface.ensureLength.

extendLengthback to summary
private void extendLength(long position) throws IOException

Some old JVM's do not allow seek beyond end of file, so zeros must be written first in that case. Reported by bohgammer@users in Open Disucssion Forum.

getExtendLengthback to summary
private long getExtendLength(long position)
getFilePointerback to summary
public long getFilePointer()

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.

newScaledRAFileback to summary
pack-priv static RandomAccessInterface newScaledRAFile(Database database, String name, boolean readonly, int type) throws IOException

seekPosition is the position in seek() calls or after reading or writing realPosition is the file position

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.

readIntoBufferback to summary
private void readIntoBuffer() throws IOException
readLongback to summary
public long readLong() throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.readLong.

resetPointerback to summary
private void resetPointer()
seekback to summary
public void seek(long position) throws IOException

Implements org.hsqldb.persist.RandomAccessInterface.seek.

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 off, 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.

writeToBufferback to summary
private int writeToBuffer(byte[] b, int off, int len)