|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JRandomAccessFile
Instances of this interface support both reading and writing to a random
access file. A random access file behaves like a large array of bytes stored
in the file system. There is a kind of cursor, or index into the implied
array, called the file pointer; input operations read bytes starting at
the file pointer and advance the file pointer past the bytes read.
If the random access file is created in read/write mode, then output
operations are also available; output operations write bytes starting at
the file pointer and advance the file pointer past the bytes written.
Output operations that write past the current end of the implied array cause
the array to be extended. The file pointer can be read by
the getFilePointer
method and set by the seek method.
Method Summary | |
---|---|
void |
close()
Closes this random access file stream and releases any system resources associated with the stream. |
JFile |
getFile()
Returns JFile instance associated with this object. |
long |
getFilePointer()
Returns the current offset in this file. |
int |
read()
Reads a byte of data from this file. |
int |
read(byte[] b)
Reads up to b.length bytes of data from this file
into an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this file into an array of bytes. |
void |
setFilePointer(long filePointer)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. |
void |
write(byte[] b)
Writes b.length bytes from the specified byte array to this file, starting at the current file pointer. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting at offset off to this file. |
void |
write(int b)
Writes the specified byte to this file. |
Method Detail |
---|
void close() throws java.io.IOException
java.io.IOException
- if an I/O error occurredlong getFilePointer() throws java.io.IOException
java.io.IOException
- if an I/O error occurredvoid setFilePointer(long filePointer) throws java.io.IOException
filePointer
- the offset position, measured in bytes from the beginning
of the file, at which to set the file pointer
java.io.IOException
- if an I/O error occurredint read() throws java.io.IOException
java.io.IOException
- if an I/O error occurredint read(byte[] b) throws java.io.IOException
b.length
bytes of data from this file
into an array of bytes.
This method blocks until at least one byte of input is available.
b
- the buffer into which the data is read
java.io.IOException
- if an I/O error occurredint read(byte[] b, int off, int len) throws java.io.IOException
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
java.io.IOException
- if an I/O error occurredvoid write(int b) throws java.io.IOException
b
- the byte to be written
java.io.IOException
- if an I/O error occurredvoid write(byte[] b) throws java.io.IOException
b
- the data
java.io.IOException
- if an I/O error occurredvoid write(byte[] b, int off, int len) throws java.io.IOException
b
- the dataoff
- the start offset in the datalen
- the number of bytes to write
java.io.IOException
- if an I/O error occurredJFile getFile()
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |