Package com.mku.fs.file
Class WSFile
java.lang.Object
com.mku.fs.file.WSFile
- All Implemented Interfaces:
IFile
IFile implementation for a remote web service file.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mku.fs.file.IFile
IFile.CopyContentsOptions, IFile.CopyOptions, IFile.MoveOptions, IFile.RecursiveCopyOptions, IFile.RecursiveDeleteOptions, IFile.RecursiveMoveOptions -
Field Summary
FieldsFields inherited from interface com.mku.fs.file.IFile
autoRename -
Constructor Summary
ConstructorsConstructorDescriptionWSFile(String path, String servicePath, Credentials credentials) Instantiate a real file represented by the filepath provided (Remote read-write drive) -
Method Summary
Modifier and TypeMethodDescriptionCopy this file or directory under a new directory.copy(IFile newDir, IFile.CopyOptions options) Copy this file or directory under a new directory.createDirectory(String dirName) Create a directory under this directory.createFile(String filename) Create a file under this directory.booleandelete()Delete this file or directory.booleanexists()Check if file or directory exists.Get the file or directory under this directory with the provided name.intGet the count of files and subdirectoriesGet the user credentialsGet the display path on the physical disk.Get a stream for reading the file.longGet the last modified date on disk.longGet the size of the file on disk.getName()Get the name of this file or directory.Get a stream for writing to this file.Get the parent directory of this file or directory.getPath()Get the path of this file.Get the service pathbooleanCheck if this is a directory.booleanisFile()Check if this is a file.IFile[]List all files under this directory.booleanmkdir()Create this directory under the current filepath.Move this file or directory under a new directory.move(IFile newDir, IFile.MoveOptions options) Move this file or directory under a new directory.booleanRename the current file or directory.voidreset()Reset cached propertiestoString()Returns a string representation of this objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.mku.fs.file.IFile
copyRecursively, copyRecursively, deleteRecursively, deleteRecursively, moveRecursively, moveRecursively
-
Field Details
-
separator
Directory Separator- See Also:
-
-
Constructor Details
-
WSFile
Instantiate a real file represented by the filepath provided (Remote read-write drive)- Parameters:
path- The filepath. This should be a relative path of the vault folderservicePath- The REST API server pathcredentials- The REST API credentials
-
-
Method Details
-
getServicePath
Get the service path- Returns:
- The service path
-
getCredentials
Get the user credentials- Specified by:
getCredentialsin interfaceIFile- Returns:
- The credentials
-
createDirectory
Create a directory under this directory.- Specified by:
createDirectoryin interfaceIFile- Parameters:
dirName- The name of the new directory.- Returns:
- The newly created directory.
-
createFile
Create a file under this directory.- Specified by:
createFilein interfaceIFile- Parameters:
filename- The name of the new file.- Returns:
- The newly created file.
- Throws:
IOException- Thrown if there is an IO error.
-
delete
public boolean delete()Delete this file or directory. -
exists
public boolean exists()Check if file or directory exists. -
getDisplayPath
Get the display path on the physical disk. For java this is the same as the filepath.- Specified by:
getDisplayPathin interfaceIFile- Returns:
- The display path.
-
getName
Get the name of this file or directory. -
getInputStream
Get a stream for reading the file.- Specified by:
getInputStreamin interfaceIFile- Returns:
- The stream to read from.
- Throws:
FileNotFoundException- Thrown if file not found
-
getOutputStream
Get a stream for writing to this file.- Specified by:
getOutputStreamin interfaceIFile- Returns:
- The stream to write to.
- Throws:
FileNotFoundException- Thrown if file not found
-
getParent
Get the parent directory of this file or directory. -
getPath
Get the path of this file. -
isDirectory
public boolean isDirectory()Check if this is a directory.- Specified by:
isDirectoryin interfaceIFile- Returns:
- True if it's a directory.
-
isFile
public boolean isFile()Check if this is a file. -
getLastDateModified
public long getLastDateModified()Get the last modified date on disk.- Specified by:
getLastDateModifiedin interfaceIFile- Returns:
- The last modified date in milliseconds
-
getLength
public long getLength()Get the size of the file on disk. -
getChildrenCount
public int getChildrenCount()Get the count of files and subdirectories- Specified by:
getChildrenCountin interfaceIFile- Returns:
- The children count
-
listFiles
List all files under this directory. -
move
Move this file or directory under a new directory.- Specified by:
movein interfaceIFile- Parameters:
newDir- The target directory.- Returns:
- The moved file. Use this file for subsequent operations instead of the original.
- Throws:
IOException- Thrown if there is an IO error.
-
move
Move this file or directory under a new directory.- Specified by:
movein interfaceIFile- Parameters:
newDir- The target directory.options- The options- Returns:
- The moved file. Use this file for subsequent operations instead of the original.
- Throws:
IOException- Thrown if there is an IO error.
-
copy
Copy this file or directory under a new directory.- Specified by:
copyin interfaceIFile- Parameters:
newDir- The target directory.- Returns:
- The copied file. Use this file for subsequent operations instead of the original.
- Throws:
IOException- Thrown if there is an IO error.
-
copy
Copy this file or directory under a new directory.- Specified by:
copyin interfaceIFile- Parameters:
newDir- The target directory.options- The options- Returns:
- The copied file. Use this file for subsequent operations instead of the original.
- Throws:
IOException- Thrown if there is an IO error.
-
getChild
Get the file or directory under this directory with the provided name. -
renameTo
Rename the current file or directory. -
mkdir
public boolean mkdir()Create this directory under the current filepath. -
reset
public void reset()Reset cached properties -
toString
Returns a string representation of this object
-