org.apache.cassandra.io.util
Class BufferedRandomAccessFile
java.lang.Object
java.io.RandomAccessFile
org.apache.cassandra.io.util.BufferedRandomAccessFile
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataInput, java.io.DataOutput, FileDataInput
public class BufferedRandomAccessFile
- extends java.io.RandomAccessFile
- implements FileDataInput
A BufferedRandomAccessFile 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.
| Methods inherited from class java.io.RandomAccessFile |
getChannel, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, 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, wait, wait, wait |
| Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.lang.String name,
java.lang.String mode)
throws java.io.IOException
- Throws:
java.io.IOException
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.lang.String name,
java.lang.String mode,
int bufferSize)
throws java.io.IOException
- Throws:
java.io.IOException
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.io.File file,
java.lang.String mode)
throws java.io.IOException
- Throws:
java.io.IOException
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.io.File file,
java.lang.String mode,
int bufferSize)
throws java.io.IOException
- Throws:
java.io.IOException
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.io.File file,
java.lang.String mode,
int bufferSize,
boolean skipCache)
throws java.io.IOException
- Throws:
java.io.IOException
sync
public void sync()
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Throws:
java.io.IOException
setLength
public void setLength(long newLength)
throws java.io.IOException
- Overrides:
setLength in class java.io.RandomAccessFile
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Overrides:
read in class java.io.RandomAccessFile
- Throws:
java.io.IOException
read
public int read(byte[] buffer)
throws java.io.IOException
- Overrides:
read in class java.io.RandomAccessFile
- Throws:
java.io.IOException
read
public int read(byte[] buff,
int offset,
int length)
throws java.io.IOException
- Overrides:
read in class java.io.RandomAccessFile
- Throws:
java.io.IOException
readBytes
public java.nio.ByteBuffer readBytes(int length)
throws java.io.IOException
- Description copied from interface:
FileDataInput
- Read length bytes from current file position
- Specified by:
readBytes in interface FileDataInput
- Parameters:
length - length of the bytes to read
- Returns:
- buffer with bytes read
- Throws:
java.io.IOException - if any I/O operation failed
write
public void write(int val)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput- Overrides:
write in class java.io.RandomAccessFile
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput- Overrides:
write in class java.io.RandomAccessFile
- Throws:
java.io.IOException
write
public void write(byte[] buff,
int offset,
int length)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput- Overrides:
write in class java.io.RandomAccessFile
- Throws:
java.io.IOException
seek
public void seek(long newPosition)
throws java.io.IOException
- Overrides:
seek in class java.io.RandomAccessFile
- Throws:
java.io.IOException
skipBytes
public int skipBytes(int count)
throws java.io.IOException
- Specified by:
skipBytes in interface java.io.DataInput- Overrides:
skipBytes in class java.io.RandomAccessFile
- Throws:
java.io.IOException
length
public long length()
throws java.io.IOException
- Overrides:
length in class java.io.RandomAccessFile
- Throws:
java.io.IOException
getFilePointer
public long getFilePointer()
- Overrides:
getFilePointer in class java.io.RandomAccessFile
getPath
public java.lang.String getPath()
- Specified by:
getPath in interface FileDataInput
isEOF
public boolean isEOF()
throws java.io.IOException
- Specified by:
isEOF in interface FileDataInput
- Returns:
- true if there is no more data to read
- Throws:
java.io.IOException
bytesRemaining
public long bytesRemaining()
throws java.io.IOException
- Specified by:
bytesRemaining in interface FileDataInput
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.RandomAccessFile
- Throws:
java.io.IOException
reset
public void reset()
throws java.io.IOException
- Throws:
java.io.IOException
bytesPastMark
public long bytesPastMark()
mark
public FileMark mark()
- Specified by:
mark in interface FileDataInput
reset
public void reset(FileMark mark)
throws java.io.IOException
- Specified by:
reset in interface FileDataInput
- Throws:
java.io.IOException
bytesPastMark
public long bytesPastMark(FileMark mark)
- Specified by:
bytesPastMark in interface FileDataInput
getUncachingReader
public static BufferedRandomAccessFile getUncachingReader(java.lang.String filename)
throws java.io.IOException
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
Copyright © 2011 The Apache Software Foundation