|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nachos.machine.OpenFile
A file that supports reading, writing, and seeking.
Constructor Summary | |
OpenFile()
Allocate a new OpenFile object. |
Method Summary | |
void |
close()
Close this file and release any associated system resources. |
int |
length()
Get the length of this file. |
int |
read(byte[] buf,
int offset,
int length)
Read this file starting at the current file pointer and return the number of bytes successfully read. |
int |
read(int pos,
byte[] buf,
int offset,
int length)
Read this file starting at the specified position and return the number of bytes successfully read. |
void |
seek(int pos)
Set the value of the current file pointer. |
int |
tell()
Get the value of the current file pointer, or -1 if this file has no pointer. |
int |
write(byte[] buf,
int offset,
int length)
Write this file starting at the current file pointer and return the number of bytes successfully written. |
int |
write(int pos,
byte[] buf,
int offset,
int length)
Write this file starting at the specified position and return the number of bytes successfully written. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public OpenFile()
Method Detail |
public int read(int pos, byte[] buf, int offset, int length)
pos
- the offset in the file at which to start reading.buf
- the buffer to store the bytes in.offset
- the offset in the buffer to start storing bytes.length
- the number of bytes to read.public int write(int pos, byte[] buf, int offset, int length)
pos
- the offset in the file at which to start writing.buf
- the buffer to get the bytes from.offset
- the offset in the buffer to start getting.length
- the number of bytes to write.public int length()
public void close()
public void seek(int pos)
public int tell()
public int read(byte[] buf, int offset, int length)
buf
- the buffer to store the bytes in.offset
- the offset in the buffer to start storing bytes.length
- the number of bytes to read.public int write(byte[] buf, int offset, int length)
buf
- the buffer to get the bytes from.offset
- the offset in the buffer to start getting.length
- the number of bytes to write.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |