public final class BufferedRandomAccessFile extends RandomAccessFile
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.
Author : Avinash Lakshman ( alakshman@facebook.com) and Prashant Malik ( pmalik@facebook.com )
| Modifier and Type | Field and Description |
|---|---|
static int |
BuffSz_ |
| Constructor and Description |
|---|
BufferedRandomAccessFile(File file,
String mode)
Open a new
BufferedRandomAccessFile on file
in mode mode, which should be "r" for reading only, or
"rw" for reading and writing. |
BufferedRandomAccessFile(File file,
String mode,
int size) |
BufferedRandomAccessFile(String name,
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. |
BufferedRandomAccessFile(String name,
String mode,
int size) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush()
Flush any bytes in the file's buffer that have not yet been written to
disk.
|
long |
getFilePointer() |
long |
length() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
seek(long pos) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
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, writeUTFpublic static final int BuffSz_
public BufferedRandomAccessFile(File file, String mode) throws IOException
BufferedRandomAccessFile on file
in mode mode, which should be "r" for reading only, or
"rw" for reading and writing.IOExceptionpublic BufferedRandomAccessFile(File file, String mode, int size) throws IOException
IOExceptionpublic BufferedRandomAccessFile(String name, String mode) throws IOException
BufferedRandomAccessFile on the file named
name in mode mode, which should be "r" for
reading only, or "rw" for reading and writing.IOExceptionpublic BufferedRandomAccessFile(String name, String mode, int size) throws FileNotFoundException
FileNotFoundExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class RandomAccessFileIOExceptionpublic void flush()
throws IOException
IOExceptionpublic void seek(long pos)
throws IOException
seek in class RandomAccessFileIOExceptionpublic long getFilePointer()
getFilePointer in class RandomAccessFilepublic long length()
throws IOException
length in class RandomAccessFileIOExceptionpublic int read()
throws IOException
read in class RandomAccessFileIOExceptionpublic int read(byte[] b)
throws IOException
read in class RandomAccessFileIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class RandomAccessFileIOExceptionpublic void write(int b)
throws IOException
write in interface DataOutputwrite in class RandomAccessFileIOExceptionpublic void write(byte[] b)
throws IOException
write in interface DataOutputwrite in class RandomAccessFileIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in class RandomAccessFileIOExceptionCopyright © 2017. All rights reserved.