uk.ac.rdg.resc.jstyx.gridservice.server
Class SGSInputFile.StdinFile
java.lang.Object
uk.ac.rdg.resc.jstyx.server.StyxFile
uk.ac.rdg.resc.jstyx.gridservice.server.SGSInputFile
uk.ac.rdg.resc.jstyx.gridservice.server.SGSInputFile.StdinFile
- Enclosing class:
- SGSInputFile
public static class SGSInputFile.StdinFile
- extends SGSInputFile
file through which clients can write to the process's input stream directly
|
Constructor Summary |
SGSInputFile.StdinFile(uk.ac.rdg.resc.jstyx.gridservice.server.StyxGridServiceInstance instance)
Creates new StdinFile - will be called "stdin" |
|
Method Summary |
protected void |
closeOutput()
Closes the output file or stream. |
void |
setOutputStream(java.io.OutputStream os)
|
void |
setURL(java.net.URL url)
|
void |
write(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
Writes data to this file. |
protected void |
writeData(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
This just writes the data to the current position in the stream
and flushes the write. |
| Methods inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile |
addChangeListener, addClient, checkSetLastModifiedTime, checkSetLength, checkSetMode, checkSetName, clientConnected, clientDisconnected, contentsChanged, delete, fireContentsChanged, getClient, getDirEntry, getFullPath, getGroup, getLength, getName, getNumClients, getOwner, getParent, getPermissions, getQid, getVersion, incrementVersion, isAppendOnly, isAuth, isDirectory, isExclusive, processAndReplyRead, processAndReplyRead, processAndReplyRead, read, 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 |
SGSInputFile.StdinFile
public SGSInputFile.StdinFile(uk.ac.rdg.resc.jstyx.gridservice.server.StyxGridServiceInstance instance)
throws StyxException
- Creates new StdinFile - will be called "stdin"
- Throws:
StyxException
setOutputStream
public void setOutputStream(java.io.OutputStream os)
writeData
protected void writeData(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
throws StyxException,
java.io.IOException
- This just writes the data to the current position in the stream
and flushes the write. The offset is ignored. The "bytesConsumed"
service data element is updated
- Specified by:
writeData in class SGSInputFile
- Throws:
StyxException
java.io.IOException
write
public void write(StyxFileClient client,
long offset,
int count,
org.apache.mina.common.ByteBuffer data,
boolean truncate,
int tag)
throws StyxException
- Description copied from class:
StyxFile
- Writes data to this file. Must check that the file is open for writing
before this. We have already dealt with the possibility that this is an
append-only file before calling this method so subclasses do not need to
check this. Subclasses must make sure they reply to the write request by
calling writeReply() (although this can be done at any time; it does not
have to be done within the write() method).
After this method is called, ByteBuffer containing the data will be
returned to the pool. If subclasses wish to keep the ByteBuffer after
this method is complete, they should call data.acquire() to increase
the reference count to the buffer.
This default implementation simply throws a StyxException, which will
result in an Rerror message being sent back to the client. Subclasses
should override this to provide the desired behaviour when the file is
written to.
- Overrides:
write in class StyxFile
- Parameters:
client - 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())
- Throws:
StyxException
setURL
public void setURL(java.net.URL url)
throws StyxException
- Overrides:
setURL in class SGSInputFile
- Throws:
StyxException
closeOutput
protected void closeOutput()
throws java.io.IOException
- Description copied from class:
SGSInputFile
- Closes the output file or stream. This default implementation does nothing
- Specified by:
closeOutput in class SGSInputFile
- Throws:
java.io.IOException
Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.