|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectiitb.con.io.BufferedFileAdapter
public class BufferedFileAdapter
BufferedFileAdapter uses ByteBuffer as the buffer to perform read and write file operations. It uses RandomAccessFile as the file operation mode.
| Constructor Summary | |
|---|---|
BufferedFileAdapter(java.lang.String name,
java.lang.String mode)
Constructs the BufferedFileAdapter with specified file name and mode |
|
BufferedFileAdapter(java.lang.String name,
java.lang.String mode,
int bufferSize)
Constructs the BufferedFileAdapter with specified file name and mode |
|
| Method Summary | |
|---|---|
void |
close()
Closes the IO Adapter |
long |
getFileLength()
Returns the length of the file |
byte[] |
read(long location,
int length)
Reads the contents and return it as byte array. |
java.nio.ByteBuffer[] |
readFileAsBlocks()
Reads the entire contents of the file as ByteBuffer array. The contents are divided as block based on the block size value |
java.nio.ByteBuffer |
readIntoBuffer(long location)
Reads the contents into the temporary buffer and returns it as ByteBuffer |
void |
write(byte[] block,
long location)
Writes the contents to the specified location. |
void |
write(java.nio.ByteBuffer[] blocks,
long location)
Writes the contents provided as array to the specified location. |
void |
write(java.nio.ByteBuffer block,
long location)
Writes the contents to the specified location. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedFileAdapter(java.lang.String name,
java.lang.String mode)
throws java.io.FileNotFoundException
name - file namemode - file opening mode (r, rw)
java.io.FileNotFoundException - if file does not exists
public BufferedFileAdapter(java.lang.String name,
java.lang.String mode,
int bufferSize)
throws java.io.FileNotFoundException
name - file namemode - file opening mode (r, rw)bufferSize - buffer size
java.io.FileNotFoundException - if file does not exists| Method Detail |
|---|
public void close()
throws java.io.IOException
close in interface IOAdapterjava.io.IOException - if file operation failspublic long getFileLength()
getFileLength in interface IOAdapter
public byte[] read(long location,
int length)
throws java.io.IOException
read in interface IOAdapterlocation - location of the content in filelength - length of the content to read from the specified location
java.io.IOException
public java.nio.ByteBuffer[] readFileAsBlocks()
throws java.io.IOException
readFileAsBlocks in interface IOAdapterjava.io.IOException - if file operation fails
public java.nio.ByteBuffer readIntoBuffer(long location)
throws java.io.IOException
readIntoBuffer in interface IOAdapterlocation - location to be read
java.io.IOException - if file operation fails
public void write(byte[] block,
long location)
throws java.io.IOException
write in interface IOAdapterblock - the content blocklocation - location to be written
java.io.IOException - if file operation fails
public void write(java.nio.ByteBuffer[] blocks,
long location)
throws java.io.IOException
write in interface IOAdapterblocks - contents as array of blockslocation - location to be written
java.io.IOException - if file operation fails
public void write(java.nio.ByteBuffer block,
long location)
throws java.io.IOException
write in interface IOAdapterblock - the content blocklocation - location to be written
java.io.IOException - if file operation fails
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||