Package com.mku.fs.file
Class HttpFile
- java.lang.Object
-
- com.mku.fs.file.HttpFile
-
-
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
Fields Modifier and Type Field Description static java.lang.String
separator
Directory separator-
Fields inherited from interface com.mku.fs.file.IFile
autoRename
-
-
Constructor Summary
Constructors Constructor Description HttpFile(java.lang.String path)
Instantiate a real file represented by the filepath provided (Remote read-write drive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFile
copy(IFile newDir)
Move this file or directory under a new directory.IFile
copy(IFile newDir, IFile.CopyOptions options)
Move this file or directory under a new directory.IFile
createDirectory(java.lang.String dirName)
Create a directory under this directory.IFile
createFile(java.lang.String filename)
Create a file under this directory.boolean
delete()
Delete this file or directory.boolean
exists()
Check if file or directory exists.IFile
getChild(java.lang.String filename)
Get the file or directory under this directory with the provided name.int
getChildrenCount()
Get the count of files and subdirectoriesjava.lang.String
getDisplayPath()
Get the display path on the physical disk.RandomAccessStream
getInputStream()
Get a stream for reading the file.long
getLastDateModified()
Get the last modified date on disk.long
getLength()
Get the size of the file on disk.java.lang.String
getName()
Get the name of this file or directory.RandomAccessStream
getOutputStream()
Get a stream for writing to this file.IFile
getParent()
Get the parent directory of this file or directory.java.lang.String
getPath()
Get the path of this file.boolean
isDirectory()
Check if this is a directory.boolean
isFile()
Check if this is a file.IFile[]
listFiles()
List all files under this directory.boolean
mkdir()
Create this directory under the current filepath.IFile
move(IFile newDir)
Move this file or directory under a new directory.IFile
move(IFile newDir, IFile.MoveOptions options)
Move this file or directory under a new directory.boolean
renameTo(java.lang.String newFilename)
Rename the current file or directory.void
reset()
Reset cached propertiesjava.lang.String
toString()
Returns a string representation of this object-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.mku.fs.file.IFile
copyRecursively, copyRecursively, deleteRecursively, deleteRecursively, moveRecursively, moveRecursively
-
-
-
-
Field Detail
-
separator
public static final java.lang.String separator
Directory separator- See Also:
- Constant Field Values
-
-
Method Detail
-
createDirectory
public IFile createDirectory(java.lang.String dirName)
Create a directory under this directory.- Specified by:
createDirectory
in interfaceIFile
- Parameters:
dirName
- The name of the new directory.- Returns:
- The newly created directory.
-
createFile
public IFile createFile(java.lang.String filename) throws java.io.IOException
Create a file under this directory.- Specified by:
createFile
in interfaceIFile
- Parameters:
filename
- The name of the new file.- Returns:
- The newly created file.
- Throws:
java.io.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
public java.lang.String getDisplayPath()
Get the display path on the physical disk.- Specified by:
getDisplayPath
in interfaceIFile
- Returns:
- The display path.
-
getName
public java.lang.String getName()
Get the name of this file or directory.
-
getInputStream
public RandomAccessStream getInputStream() throws java.io.FileNotFoundException
Get a stream for reading the file.- Specified by:
getInputStream
in interfaceIFile
- Returns:
- The stream to read from.
- Throws:
java.io.FileNotFoundException
- Thrown if file not found
-
getOutputStream
public RandomAccessStream getOutputStream() throws java.io.FileNotFoundException
Get a stream for writing to this file.- Specified by:
getOutputStream
in interfaceIFile
- Returns:
- The stream to write to.
- Throws:
java.io.FileNotFoundException
- Thrown if file not found
-
getParent
public IFile getParent()
Get the parent directory of this file or directory.
-
getPath
public java.lang.String getPath()
Get the path of this file.
-
isDirectory
public boolean isDirectory()
Check if this is a directory.- Specified by:
isDirectory
in 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:
getLastDateModified
in 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:
getChildrenCount
in interfaceIFile
- Returns:
- The children count
-
listFiles
public IFile[] listFiles()
List all files under this directory.
-
move
public IFile move(IFile newDir) throws java.io.IOException
Move this file or directory under a new directory. Not supported.
-
move
public IFile move(IFile newDir, IFile.MoveOptions options) throws java.io.IOException
Move this file or directory under a new directory. Not supported.
-
copy
public IFile copy(IFile newDir) throws java.io.IOException
Move this file or directory under a new directory. Not supported.
-
copy
public IFile copy(IFile newDir, IFile.CopyOptions options) throws java.io.IOException
Move this file or directory under a new directory. Not supported.
-
getChild
public IFile getChild(java.lang.String filename)
Get the file or directory under this directory with the provided name.
-
renameTo
public boolean renameTo(java.lang.String newFilename)
Rename the current file or directory.
-
mkdir
public boolean mkdir()
Create this directory under the current filepath.
-
toString
public java.lang.String toString()
Returns a string representation of this object- Overrides:
toString
in classjava.lang.Object
-
-