|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.utility.BufferedRandomAccessFile | +--com.objectwave.utility.CachedRandomAccessFile
Extension fo the RandomAccessFile to cache the file until flush() is called.
Usable with the com.objectwave.persist.FileBroker
. Publically
identical to java.io.RandomAccessFile
, except for the
constuctor, flush()
, and readFile()
.
Note: This class is not threadsafe.
RandomAccessFile
Nested Class Summary | |
protected class |
CachedRandomAccessFile.FileBlock
|
static class |
CachedRandomAccessFile.Test
Description of the Class |
Nested classes inherited from class com.objectwave.utility.BufferedRandomAccessFile |
BufferedRandomAccessFile.FileBufferStruct, BufferedRandomAccessFile.Test |
Field Summary |
Fields inherited from class com.objectwave.utility.BufferedRandomAccessFile |
altBuf, currBuf |
Constructor Summary | |
CachedRandomAccessFile(java.io.File file,
java.lang.String mode,
int blockSize,
boolean fullCache)
Constructor for the CachedRandomAccessFile object |
Method Summary | |
void |
flush()
Description of the Method |
protected CachedRandomAccessFile.FileBlock |
getBlock(long position)
Gets the Block attribute of the CachedRandomAccessFile object |
long |
getFilePointer()
Gets the FilePointer attribute of the CachedRandomAccessFile object |
java.io.Reader |
getReader()
Gets the Reader attribute of the CachedRandomAccessFile object |
java.io.Writer |
getWriter()
Gets the Writer attribute of the CachedRandomAccessFile object |
long |
length()
Description of the Method |
static void |
main(java.lang.String[] args)
The main program for the CachedRandomAccessFile class |
int |
read()
Description of the Method |
int |
read(byte[] b)
Description of the Method |
int |
read(byte[] b,
int pos,
int len)
Description of the Method |
void |
readFile()
Read any unloaded blocks into memory. |
void |
seek(long pos)
Description of the Method |
void |
setLength(long newLength)
Sets the Length attribute of the CachedRandomAccessFile object |
int |
skipBytes(int n)
Description of the Method |
long |
skipBytes(long n)
Description of the Method |
void |
write(byte[] b)
Description of the Method |
void |
write(byte[] b,
int pos,
int len)
Description of the Method |
void |
write(int b)
Description of the Method |
Methods inherited from class com.objectwave.utility.BufferedRandomAccessFile |
close, commitBuffer, fillBuffer, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, syncBuffer, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CachedRandomAccessFile(java.io.File file, java.lang.String mode, int blockSize, boolean fullCache) throws java.io.IOException
file
- Description of Parametermode
- Description of ParameterblockSize
- Description of ParameterfullCache
- Description of Parameter
java.io.IOException
- Description of ExceptionMethod Detail |
public void setLength(long newLength) throws java.io.IOException
setLength
in class BufferedRandomAccessFile
newLength
- The new Length value
java.io.IOException
- Description of Exceptionpublic java.io.Reader getReader()
getReader
in class BufferedRandomAccessFile
public java.io.Writer getWriter()
getWriter
in class BufferedRandomAccessFile
public long getFilePointer()
getFilePointer
in class BufferedRandomAccessFile
public long length()
length
in class BufferedRandomAccessFile
public int read() throws java.io.IOException
read
in class BufferedRandomAccessFile
java.io.IOException
- Description of Exceptionpublic int read(byte[] b) throws java.io.IOException
read
in class BufferedRandomAccessFile
b
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic int read(byte[] b, int pos, int len) throws java.io.IOException
read
in class BufferedRandomAccessFile
b
- Description of Parameterpos
- Description of Parameterlen
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic void seek(long pos) throws java.io.IOException
seek
in class BufferedRandomAccessFile
pos
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic int skipBytes(int n) throws java.io.IOException
skipBytes
in interface java.io.DataInput
skipBytes
in class BufferedRandomAccessFile
n
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic long skipBytes(long n) throws java.io.IOException
skipBytes
in class BufferedRandomAccessFile
n
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic void write(byte[] b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class BufferedRandomAccessFile
b
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic void write(byte[] b, int pos, int len) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class BufferedRandomAccessFile
b
- Description of Parameterpos
- Description of Parameterlen
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic void write(int b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class BufferedRandomAccessFile
b
- Description of Parameter
java.io.IOException
- Description of Exceptionpublic void readFile() throws java.io.IOException
java.io.IOException
- Description of Exceptionpublic void flush() throws java.io.IOException
flush
in class BufferedRandomAccessFile
java.io.IOException
- Description of Exceptionprotected CachedRandomAccessFile.FileBlock getBlock(long position)
position
- Description of Parameter
public static void main(java.lang.String[] args)
args
- The command line arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |