|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.rdg.resc.jstyx.server.StyxFile
uk.ac.rdg.resc.jstyx.server.InMemoryFile
public class InMemoryFile
File whose underlying data are stored as a ByteBuffer in memory. This buffer can grow to arbitrary size.
| Field Summary | |
|---|---|
protected org.apache.mina.common.ByteBuffer |
buf
The org.apache.mina.common.ByteBuffer that holds the data exposed by this file. |
| Fields inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile |
|---|
auth, directory, lastModifiedTime, name, parent |
| Constructor Summary | |
|---|---|
InMemoryFile(java.lang.String name)
Creates an InMemoryFile with default permissions (0666, rw-rw-rw-) |
|
InMemoryFile(java.lang.String name,
int permissions)
|
|
InMemoryFile(java.lang.String name,
int permissions,
boolean isAppendOnly,
boolean isExclusive)
|
|
InMemoryFile(java.lang.String name,
java.lang.String userID,
java.lang.String groupID,
int permissions,
boolean isAppendOnly,
boolean isExclusive)
Creates a new instance of InMemoryFile |
|
| Method Summary | |
|---|---|
void |
delete()
Frees the resources associated with the file (releases the underlying ByteBuffer back to the pool). |
java.lang.String |
getContents()
Gets the data in this file as a String |
ULong |
getLength()
|
static void |
main(java.lang.String[] args)
|
void |
read(StyxFileClient client,
long offset,
int count,
int tag)
Reads data from this file. |
void |
setContents(java.lang.String newContents)
Set the contents of this file to the given String. |
void |
write(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
Writes data to this file. |
| Methods inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile |
|---|
addChangeListener, addClient, checkSetLastModifiedTime, checkSetLength, checkSetMode, checkSetName, clientConnected, clientDisconnected, contentsChanged, fireContentsChanged, getClient, getDirEntry, getFullPath, getGroup, getName, getNumClients, getOwner, getParent, getPermissions, getQid, getVersion, incrementVersion, isAppendOnly, isAuth, isDirectory, isExclusive, processAndReplyRead, processAndReplyRead, processAndReplyRead, refresh, remove, removeChangeListener, removeClient, rename, replyRead, replyRead, replyRead, replyRead, replyRead, replyWrite, setLastAccessTime, setLastModified, setLength, setMode, setName, setPermissions, setReadOnly |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.mina.common.ByteBuffer buf
| Constructor Detail |
|---|
public InMemoryFile(java.lang.String name,
java.lang.String userID,
java.lang.String groupID,
int permissions,
boolean isAppendOnly,
boolean isExclusive)
throws StyxException
StyxException
public InMemoryFile(java.lang.String name,
int permissions,
boolean isAppendOnly,
boolean isExclusive)
throws StyxException
StyxException
public InMemoryFile(java.lang.String name,
int permissions)
throws StyxException
StyxException
public InMemoryFile(java.lang.String name)
throws StyxException
StyxException| Method Detail |
|---|
public void read(StyxFileClient client,
long offset,
int count,
int tag)
throws StyxException
StyxFile
read in class StyxFileclient - The client that is performing the readoffset - The point in the file at which to start readingcount - The maximum number of bytes to readtag - The tag of the incoming Tread message (this is needed when
calling readReply())
StyxException
public void write(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
throws StyxException
StyxFile
write in class StyxFileclient - The client that is performing the write operationoffset - The place in the file where the new data will be addedcount - The number of bytes to writedata - The data to write. The position and limit of this ByteBuffer
will be set correctly, but subclasses should note that the position might
not be zero.truncate - If this is true the file will be truncated at the end of
the new datatag - The tag of the incoming Twrite message (this is needed when
calling writeReply())
StyxExceptionpublic void setContents(java.lang.String newContents)
public ULong getLength()
getLength in class StyxFilepublic void delete()
delete in class StyxFilepublic java.lang.String getContents()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||