Top Description Fields Constructors Methods
org.hsqldb.persist

pack-priv final Class RAFileInJar

extends Object
implements RandomAccessInterface
Class Inheritance
All Implemented Interfaces
org.hsqldb.persist.RandomAccessInterface
Imports
java.io.DataInputStream, .FileNotFoundException, .IOException, .InputStream, org.hsqldb.Database, org.hsqldb.lib.HsqlByteArrayInputStream

This class is a random access wrapper around a DataInputStream object and enables access to cached tables when a database is included in a jar. A proof-of-concept prototype was first contributed by winfriedthom@users.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.8.0
Version
2.3.0

Field Summary

Modifier and TypeField and Description
pack-priv HsqlByteArrayInputStream
pack-priv byte[]
pack-priv boolean
pack-priv long
pack-priv DataInputStream
pack-priv long
pack-priv final String
pack-priv long
pack-priv long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

public Database
public long
private long
public boolean
public long
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
seek(long position)

Implements org.hsqldb.persist.RandomAccessInterface.seek.

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

public boolean
public void
public void
write(byte[] b, int off, int len)

Implements org.hsqldb.persist.RandomAccessInterface.write.

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

Field Detail

baback to summary
pack-priv HsqlByteArrayInputStream ba
bufferback to summary
pack-priv byte[] buffer
bufferDirtyback to summary
pack-priv boolean bufferDirty
bufferOffsetback to summary
pack-priv long bufferOffset
fileback to summary
pack-priv DataInputStream file
fileLengthback to summary
pack-priv long fileLength
fileNameback to summary
pack-priv final String fileName
realPositionback to summary
pack-priv long realPosition
seekPositionback to summary
pack-priv long seekPosition

Constructor Detail

RAFileInJarback to summary
pack-priv RAFileInJar(String name) 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 newLong)

Implements org.hsqldb.persist.RandomAccessInterface.ensureLength.

fileSeekback to summary
private void fileSeek(long position) throws IOException
getDatabaseback to summary
public Database getDatabase()
getFilePointerback to summary
public long getFilePointer()

Implements org.hsqldb.persist.RandomAccessInterface.getFilePointer.

getLengthback to summary
private long getLength() throws IOException
isReadOnlyback to summary
public boolean isReadOnly()

Implements org.hsqldb.persist.RandomAccessInterface.isReadOnly.

lengthback to summary
public long length()

Implements org.hsqldb.persist.RandomAccessInterface.length.

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.

resetStreamback to summary
private void resetStream() throws IOException
seekback to summary
public void seek(long position)

Implements org.hsqldb.persist.RandomAccessInterface.seek.

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

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 len)

Implements org.hsqldb.persist.RandomAccessInterface.write.

writeIntback to summary
public void writeInt(int i)

Implements org.hsqldb.persist.RandomAccessInterface.writeInt.

writeLongback to summary
public void writeLong(long i)

Implements org.hsqldb.persist.RandomAccessInterface.writeLong.