|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.RandomAccessFile
org.apache.cassandra.io.ChecksumRandomAccessFile
public final class ChecksumRandomAccessFile
A ChecksumRandomAccessFile
is like a
RandomAccessFile
, but it uses a private buffer so that most
operations do not require a disk access.
Note: The operations on this class are unmonitored. Also, the correct
functioning of the RandomAccessFile
methods that are not
overridden here relies on the implementation of those methods in the
superclass.
Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
Field Summary | |
---|---|
static int |
BuffSz_
|
Constructor Summary | |
---|---|
ChecksumRandomAccessFile(java.io.File file,
java.lang.String mode)
Open a new BufferedRandomAccessFile on file
in mode mode , which should be "r" for reading only, or
"rw" for reading and writing. |
|
ChecksumRandomAccessFile(java.io.File file,
java.lang.String mode,
int size)
|
|
ChecksumRandomAccessFile(java.lang.String name,
java.lang.String mode)
Open a new BufferedRandomAccessFile on the file named
name in mode mode , which should be "r" for
reading only, or "rw" for reading and writing. |
|
ChecksumRandomAccessFile(java.lang.String name,
java.lang.String mode,
int size)
|
Method Summary | |
---|---|
void |
close()
|
void |
flush()
Flush any bytes in the file's buffer that have not yet been written to disk. |
long |
getFilePointer()
|
long |
length()
|
static void |
main(java.lang.String[] args)
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
seek(long pos)
This method positions this.curr at position pos . |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.RandomAccessFile |
---|
getChannel, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, 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 |
Field Detail |
---|
public static final int BuffSz_
Constructor Detail |
---|
public ChecksumRandomAccessFile(java.io.File file, java.lang.String mode) throws java.io.IOException
BufferedRandomAccessFile
on file
in mode mode
, which should be "r" for reading only, or
"rw" for reading and writing.
java.io.IOException
public ChecksumRandomAccessFile(java.io.File file, java.lang.String mode, int size) throws java.io.IOException
java.io.IOException
public ChecksumRandomAccessFile(java.lang.String name, java.lang.String mode) throws java.io.IOException
BufferedRandomAccessFile
on the file named
name
in mode mode
, which should be "r" for
reading only, or "rw" for reading and writing.
java.io.IOException
public ChecksumRandomAccessFile(java.lang.String name, java.lang.String mode, int size) throws java.io.FileNotFoundException
java.io.FileNotFoundException
Method Detail |
---|
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.RandomAccessFile
java.io.IOException
public void flush() throws java.io.IOException
java.io.IOException
public void seek(long pos) throws java.io.IOException
this.curr
at position pos
.
If pos
does not fall in the current buffer, it flushes the
current buffer and loads the correct one.
On exit from this routine this.curr == this.hi
iff pos
is at or past the end-of-file, which can only happen if the file was
opened in read-only mode.
seek
in class java.io.RandomAccessFile
java.io.IOException
public long getFilePointer()
getFilePointer
in class java.io.RandomAccessFile
public long length() throws java.io.IOException
length
in class java.io.RandomAccessFile
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.RandomAccessFile
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.RandomAccessFile
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.RandomAccessFile
java.io.IOException
public void write(int b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
java.io.IOException
public static void main(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |