|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nachos.machine.OpenFile nachos.machine.OpenFileWithPosition nachos.machine.ArrayFile
public class ArrayFile
A read-only OpenFile backed by a byte array.
Field Summary |
---|
Fields inherited from class nachos.machine.OpenFileWithPosition |
---|
position |
Constructor Summary | |
---|---|
ArrayFile(byte[] array)
Allocate a new ArrayFile. |
Method Summary | |
---|---|
void |
close()
Close this file and release any associated system resources. |
int |
length()
Get the length of this file. |
int |
read(int position,
byte[] buf,
int offset,
int length)
Read this file starting at the specified position and return the number of bytes successfully read. |
int |
write(int position,
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 nachos.machine.OpenFileWithPosition |
---|
read, seek, tell, write |
Methods inherited from class nachos.machine.OpenFile |
---|
getFileSystem, getName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayFile(byte[] array)
array
- the array backing this file.Method Detail |
---|
public int length()
OpenFile
length
in class OpenFile
public void close()
OpenFile
close
in class OpenFile
public int read(int position, byte[] buf, int offset, int length)
OpenFile
read
in class OpenFile
position
- 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 position, byte[] buf, int offset, int length)
OpenFile
write
in class OpenFile
position
- 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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |