Package com.mku.fs.file
Class HttpFile
java.lang.Object
com.mku.fs.file.HttpFile
- All Implemented Interfaces:
IFile
IFile implementation for a remote HTTP 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
ConstructorsConstructorDescriptionInstantiate a real file represented by the filepath provided (Remote read-write drive)HttpFile(String path, Credentials credentials) Instantiate a real file represented by the filepath provided (Remote read-write drive) -
Method Summary
Modifier and TypeMethodDescriptionMove this file or directory under a new directory.copy(IFile newDir, IFile.CopyOptions options) Move 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 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.booleanCheck 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 propertiesvoidsetCredentials(Credentials credentials) Set the user credentialstoString()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
-
HttpFile
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 folder
-
HttpFile
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 foldercredentials- The credentials (Basic Auth)
-
-
Method Details
-
getCredentials
Get the credentials- Specified by:
getCredentialsin interfaceIFile- Returns:
- The credentials
-
setCredentials
Set the user credentials- Parameters:
credentials- 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.- 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. Not supported.- 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. Not supported.- 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
Move this file or directory under a new directory. Not supported.- 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
Move this file or directory under a new directory. Not supported.- 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
-