|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnachos.machine.OpenFile
nachos.machine.OpenFileWithPosition
public abstract class OpenFileWithPosition
An OpenFile that maintains a current file position.
| Field Summary | |
|---|---|
protected int |
position
The current value of the file pointer. |
| Constructor Summary | |
|---|---|
OpenFileWithPosition()
Allocate a new unnamed OpenFileWithPosition that is not associated with any file system. |
|
OpenFileWithPosition(FileSystem fileSystem,
String name)
Allocate a new OpenFileWithPosition with the specified name on the specified file system. |
|
| Method Summary | |
|---|---|
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. |
void |
seek(int position)
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. |
| Methods inherited from class nachos.machine.OpenFile |
|---|
close, getFileSystem, getName, length, read, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int position
| Constructor Detail |
|---|
public OpenFileWithPosition(FileSystem fileSystem,
String name)
fileSystem - the file system to which this file belongs.name - the name of the file, on that file system.public OpenFileWithPosition()
| Method Detail |
|---|
public void seek(int position)
OpenFile
seek in class OpenFilepublic int tell()
OpenFile
tell in class OpenFilepublic int read(byte[] buf,
int offset,
int length)
OpenFile
read in class OpenFilebuf - 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)
OpenFile
write in class OpenFilebuf - 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 All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||