edu.utah.janosvm.kit.server.memfs
Class MemoryBlockBackEnd
java.lang.Object
|
+--edu.utah.janosvm.sys.Exportable
|
+--edu.utah.janosvm.kit.server.memfs.MemoryBlockBackEnd
- All Implemented Interfaces:
- TemporaryExport
- final class MemoryBlockBackEnd
- extends Exportable
- implements TemporaryExport
The object representing a file in the memory file system.
Field Summary |
private int |
actual
The actual size of the file. |
private byte[] |
data
The file data. |
(package private) static int |
DEFAULT_BLOCK_SIZE
The size of blocks allocated by the object. |
private boolean |
expired
Indicates whether or not the block has been deleted. |
Constructor Summary |
(package private) |
MemoryBlockBackEnd()
Construct an empty block. |
(package private) |
MemoryBlockBackEnd(byte[] data,
int actual)
Construct a block with the given values. |
Method Summary |
(package private) static int |
blockCount(int size)
|
boolean |
expired()
This method is called when there are no more imports for the export. |
(package private) int |
getActual()
|
(package private) byte[] |
getData()
|
java.lang.Object |
getName()
Used to determine the name of this TemporaryObject object
during revocation. |
(package private) int |
read(int cursor,
byte[] buffer,
int offset,
int length)
|
(package private) void |
setExpired(boolean expired)
|
java.lang.String |
toString()
|
(package private) void |
write(int cursor,
byte[] buffer,
int offset,
int length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0 |
DEFAULT_BLOCK_SIZE
static final int DEFAULT_BLOCK_SIZE
- The size of blocks allocated by the object.
expired
private boolean expired
- Indicates whether or not the block has been deleted. Used to answer
the expired() question asked by the ExportManager when the last
import is removed.
data
private byte[] data
- The file data.
actual
private int actual
- The actual size of the file.
MemoryBlockBackEnd
MemoryBlockBackEnd()
- Construct an empty block.
MemoryBlockBackEnd
MemoryBlockBackEnd(byte[] data,
int actual)
- Construct a block with the given values.
- Parameters:
data
- A block aligned byte array containing the file data.actual
- The actual size of the data.
blockCount
static int blockCount(int size)
- Parameters:
size
- The number of bytes that needs to be contained in blocks.- Returns:
- The number of blocks needed to contain `size'.
getName
public java.lang.Object getName()
- Description copied from interface:
TemporaryExport
- Used to determine the name of this TemporaryObject object
during revocation. Should return
null
for an
anonymous export.
- Specified by:
getName
in interface TemporaryExport
getData
byte[] getData()
- Returns:
- A block aligned byte array containing the file data.
getActual
int getActual()
- Returns:
- The actual size of the data.
read
int read(int cursor,
byte[] buffer,
int offset,
int length)
- Parameters:
cursor
- The offset to read from the file.buffer
- The buffer to read the data into.offset
- The offset into buffer to start reading.length
- The number of bytes to read into buffer.- Returns:
- The number of bytes read.
write
void write(int cursor,
byte[] buffer,
int offset,
int length)
throws DeadTeamException,
TeamEjectionException
- Parameters:
cursor
- The offset to start writing into the file.buffer
- The buffer to read the data to write.offset
- The offset into buffer to start reading.length
- The number of bytes to write into buffer.
setExpired
void setExpired(boolean expired)
- Parameters:
expired
- The new value of the expired field.
expired
public boolean expired()
- Description copied from interface:
TemporaryExport
- This method is called when there are no more imports for the export.
If it returns true than the export is revoked otherwise it will
continue to be available for importing.
- Specified by:
expired
in interface TemporaryExport
- Following copied from interface:
edu.utah.janosvm.sys.TemporaryExport
- Returns:
- True if the export has expired and should be revoked.
toString
public java.lang.String toString()
- Overrides:
toString
in class Exportable
This documentation is Copyright (C) 2000-2003 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Feb 13, 2003