|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.uva.vlet.vrs.VNode
nl.uva.vlet.vfs.VFSNode
nl.uva.vlet.vfs.VFile
public abstract class VFile
The Virtual File Interface. An abstract representation of a File.
Note that an offset into a file can be of long size, but reading is limited to 'int' size.
VDir
Field Summary |
---|
Fields inherited from class nl.uva.vlet.vfs.VFSNode |
---|
ATTR_ACCESS_TIME, ATTR_CREATION_TIME, ATTR_DATA_TYPE, ATTR_DIRNAME, ATTR_EXISTS, ATTR_GID, ATTR_GROUP, ATTR_ISDIR, ATTR_ISFILE, ATTR_ISHIDDEN, ATTR_ISREADABLE, ATTR_ISSOFTLINK, ATTR_ISWRITABLE, ATTR_LENGTH, ATTR_LINKTARGET, ATTR_MODIFICATION_TIME, ATTR_NRACLENTRIES, ATTR_NRCHILDS, ATTR_OWNER, ATTR_PARENT_DIRNAME, ATTR_PERMISSIONS_STRING, ATTR_RESOURCE, ATTR_UID, ATTR_UNIQUE, attributeNames, defaultStreamBufferSize |
Fields inherited from class nl.uva.vlet.vrs.VNode |
---|
ATTR_CHARSET, ATTR_HOSTNAME, ATTR_ICON, ATTR_ISVLINK, ATTR_LOCATION, ATTR_MIMETYPE, ATTR_NAME, ATTR_PATH, ATTR_PORT, ATTR_SCHEME, ATTR_TYPE, location, vrsContext |
Fields inherited from interface nl.uva.vlet.vfs.VACL |
---|
GROUP_ENTITY, PERM_ACCESSABLE, PERM_EXECUTABLE, PERM_READABLE, PERM_WRITABLE, USER_ENTITY, WORLD_ENTITY |
Constructor Summary | |
---|---|
VFile(VRSContext context,
VRL vrl)
|
Method Summary | |
---|---|
VFile |
copyTo(VDir dest)
Copy this file to another VFS location. |
VFile |
copyTo(VDir dest,
java.lang.String newName)
Copy this file to another VFS location. |
VFile |
copyTo(VRL destinationVrl)
see copyToFile() |
VFile |
copyToDir(VRL destinationVrl)
Copy this file to new destination location. |
VFile |
copyToFile(VRL destinationVrl)
Copy this file to new destination location. |
protected VFile |
doCopyMoveTo(VFSTransfer transfer,
VDir dest,
java.lang.String optNewName,
boolean isMove)
Default implementation to do actual copy/move. |
protected VFile |
downloadTo(VFSTransfer transfer,
VDir localDir,
java.lang.String optNewName,
boolean isMove)
Default implemenation to download files, sub classes are encouraged to override this method if they have their own (better) methods. |
byte[] |
getContents()
Read the whole contents and return in byte array. |
byte[] |
getContents(int len)
Reads first len bytes into byte array |
byte[] |
getContents(long offset,
int len)
Reads first len bytes into byte array |
java.lang.String |
getContentsAsString()
|
java.lang.String |
getContentsAsString(java.lang.String charSet)
Read contents and return as single String. |
VRL |
getHelp()
Returns simple text file or complete HTML page. |
abstract long |
getLength()
Return length of this resource object |
java.lang.String |
getType()
Returns type String of this VNode |
boolean |
isDir()
Implementation of VFSNode.isDir(). |
boolean |
isFile()
Needed by VFSNode interface. |
VFile |
moveTo(VDir dest)
Moves file from one VFS location to another. |
VFile |
moveTo(VDir dest,
java.lang.String newName)
Moves file from one VFS location to another. |
int |
read(byte[] buffer,
int nrOfBytes)
|
int |
read(byte[] buffer,
int bufferOffset,
int nrOfBytes)
|
int |
read(long offset,
byte[] buffer,
int bufferOffset,
int nrOfBytes)
Read from a (remote) VFile. Method tries to use the RandomAccessable interface or the InputStream from VStreamReasable to read from. |
void |
setContents(byte[] bytes)
Replace or create File contents with data from the bytes array. |
void |
setContents(java.lang.String contents)
Set contents using specified String. |
void |
setContents(java.lang.String contents,
java.lang.String encoding)
Set contents using specified String and encoding. |
protected static VFile |
streamCopyMove(VFSTransfer transfer,
VFile sourceFile,
VDir destDir,
java.lang.String optNewName,
boolean isMove)
This is the default way to copy file, by reading from the source file and writing it to a remote file. |
int |
streamRead(long offset,
byte[] buffer,
int bufferOffset,
int nrOfBytes)
use InputStream to read bytes, not the RandomAcces method readBytes. |
void |
streamWrite(byte[] buffer,
int bufferOffset,
int nrOfBytes)
Uses OutputStream to write to method i.s.o. |
void |
write(byte[] buffer,
int nrOfBytes)
|
void |
write(byte[] buffer,
int bufferOffset,
int nrOfBytes)
|
void |
write(long offset,
byte[] buffer,
int bufferOffset,
int nrOfBytes)
Write to VFile, note that not all implementations of VFile can write to (Remote) Files. Use isRandomAccessable() first to determine whether this file can be randomly written to. |
Methods inherited from class nl.uva.vlet.vfs.VFSNode |
---|
asyncCopyMoveTo, create, createACLRecord, createTransfer, createTransferTo, deleteACLEntity, exists, getACL, getACLEntities, getAttribute, getAttributeNames, getLinkTarget, getLinkTargetVRL, getModificationTime, getParent, getParents, getPath, getPermissionsString, getRoot, getTranferInfo, isDeletable, isEditable, isHidden, isLink, isLocal, isRandomAccessable, isReadable, isRenamable, isWritable, returnAsArray, setACL, setAttribute, setAttributes, startCopyMoveTo, startCopyMoveTo |
Methods inherited from class nl.uva.vlet.vrs.VNode |
---|
compareTo, getAttributes, getAttributes, getAttributeSet, getBasename, getCharSet, getHostname, getIconURL, getID, getLocation, getMimeType, getName, getPath, getPort, getScheme, getServerAttributes, getURI, getVRL, getVRSContext, isComposite, isVirtual, isVLink, mergedGetAttributes, setLocation, setVRL, toLinkNode, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface nl.uva.vlet.vrs.VRenamable |
---|
isRenamable, renameTo |
Methods inherited from interface nl.uva.vlet.vrs.VEditable |
---|
delete, isDeletable, isEditable, setAttribute, setAttributes |
Methods inherited from interface nl.uva.vlet.vrs.VStreamReadable |
---|
getInputStream |
Methods inherited from interface nl.uva.vlet.vrs.VStreamWritable |
---|
getOutputStream |
Methods inherited from interface nl.uva.vlet.vrs.VRandomAccessable |
---|
readBytes, setLengthToZero, writeBytes |
Constructor Detail |
---|
public VFile(VRSContext context, VRL vrl)
Method Detail |
---|
public java.lang.String getType()
getType
in class VNode
public VRL getHelp()
VNode
getHelp
in class VNode
public boolean isFile()
isFile
in class VFSNode
VFSNode.isFile()
public boolean isDir()
isDir
in class VFSNode
VFSNode.isDir()
public byte[] getContents() throws VlException
VlException
public byte[] getContents(int len) throws VlException
len bytes into byte array
- Throws:
VlException
public byte[] getContents(long offset, int len) throws VlException
len bytes into byte array
- Throws:
VlException
public java.lang.String getContentsAsString(java.lang.String charSet) throws VlException
VlException
public java.lang.String getContentsAsString() throws VlException
VlException
public final VFile copyTo(VRL destinationVrl) throws VlException
VlException
public final VFile copyToFile(VRL destinationVrl) throws VlException
destinationVrl
-
VlException
public final VFile copyToDir(VRL destinationVrl) throws VlException
destinationVrl
-
VlException
public final VFile copyTo(VDir dest) throws VlException
copyTo
in class VFSNode
b
-
VlException
VFS#cmoveFile(VFile, VDir, boolean)
public final VFile copyTo(VDir dest, java.lang.String newName) throws VlException
copyTo
in class VFSNode
b
-
VlException
VFS#cmoveFile(VFile, VDir, boolean)
public final VFile moveTo(VDir dest) throws VlException
moveTo
in class VFSNode
VlException
#doCopyMoveTo(VDir, boolean)
public final VFile moveTo(VDir dest, java.lang.String newName) throws VlException
moveTo
in class VFSNode
VlException
#doCopyMoveTo(VDir, boolean)
public void write(long offset, byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
VlException
read
,
VRandomAccessable
public void write(byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
VlException
public void write(byte[] buffer, int nrOfBytes) throws VlException
VlException
public void streamWrite(byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
VlException
public void setContents(java.lang.String contents, java.lang.String encoding) throws VlException
contents
- :
new Contentsencoding
- :
charset to use
VlException
- if contents can not be set somehowpublic int read(long offset, byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
offset
- nrOfBytes
- bufferOffset
- buffer
-
VlException
- if interface does not support remote read access.public int read(byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
VlException
read(long offset, byte buffer[],int bufferOffset,int nrOfBytes)
public int read(byte[] buffer, int nrOfBytes) throws VlException
VlException
read(long offset, byte buffer[],int bufferOffset,int nrOfBytes)
public int streamRead(long offset, byte[] buffer, int bufferOffset, int nrOfBytes) throws VlException
VlException
public void setContents(byte[] bytes) throws VlException
VlException
public void setContents(java.lang.String contents) throws VlException
contents
- :
new Contents String
VlException
to specify the coding
protected VFile doCopyMoveTo(VFSTransfer transfer, VDir dest, java.lang.String optNewName, boolean isMove) throws VlException
This File Remote Destination isMove method local remote - VDir.uploadFile remote local - VFile.downloadTo [Source has same server as dest] true renameTo - - - VFile.streamcopyImplementations can choose wether to override this method or the one of the upload/download methods
transfer
-
VlException
moveTo(VDir)
,
copyTo(VDir)
,
VDir.uploadFile(VFile)
,
VFile.downloadTo(VDir,String,boolean)
protected VFile downloadTo(VFSTransfer transfer, VDir localDir, java.lang.String optNewName, boolean isMove) throws VlException
VlException
VDir.uploadFile
,
VDir.uploadDir
protected static VFile streamCopyMove(VFSTransfer transfer, VFile sourceFile, VDir destDir, java.lang.String optNewName, boolean isMove) throws VlException
TODO: make it multithreaded so progress statistics can be kept.
transfer
-
VlException
VStreamWritable
,
VStreamReadable
public abstract long getLength() throws VlException
VlException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |