|
kAWT Version 0.96 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.RandomAccessFile
Instances of this class support both reading and writing to a random access file.
Constructor Summary | |
RandomAccessFile(File file,
String mode)
Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument. |
|
RandomAccessFile(String name,
String mode)
Creates a random access file stream to read from, and optionally to write to, a file with the specified name. |
Method Summary | |
void |
close()
Closes this random access file stream and releases any system resources associated with the stream. |
int |
getFilePointer()
Returns the current offset in this file. |
int |
length()
Returns the length of this file. |
byte |
read()
Reads a byte of data from this file. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
int |
read(byte[] b,
int start,
int len)
Reads up to len bytes of data from this file into an array of bytes. |
String |
readLine()
Reads the next line of text from this file. |
void |
seek(int pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
void |
setLength(int newLength)
Sets the length of this file. |
void |
write(byte b)
Writes the specified byte to this file. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
void |
write(byte[] b,
int offset,
int len)
Writes len bytes from the specified byte array starting at offset off to this file. |
void |
writeChars(String s)
Writes a string to the file as a sequence of characters. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public RandomAccessFile(String name, String mode) throws IOException
name
- the system-dependent filename.mode
- the access mode.public RandomAccessFile(File file, String mode) throws IOException
file
- the file object.mode
- the access mode.Method Detail |
public void close() throws IOException
public int getFilePointer() throws IOException
public int length() throws IOException
public byte read()
public int read(byte[] b, int start, int len) throws IOException
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the maximum number of bytes read.public void write(byte[] b, int offset, int len) throws IOException
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.public String readLine() throws IOException
public void seek(int pos) throws IOException
pos
- the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.public void setLength(int newLength) throws IOException
newLength
- The desired length of the filepublic void write(byte b) throws IOException
b
- the byte to be written.public void writeChars(String s) throws IOException
s
- a String value to be written.
|
kAWT Version 0.96 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |