Package com.mku.fs.file
Interface IVirtualFile
-
- All Known Implementing Classes:
AesFile
public interface IVirtualFileA virtual file. Read-only operations are included. Since write operations can be implementation specific ie for encryption they can be implemented by extending this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIVirtualFile.VirtualRecursiveCopyOptionsDirectory copy options (recursively)static classIVirtualFile.VirtualRecursiveDeleteOptionsDirectory move options (recursively)static classIVirtualFile.VirtualRecursiveMoveOptionsDirectory move options (recursively)
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IVirtualFilecopy(IVirtualFile dir)Copy file to another directory.IVirtualFilecopy(IVirtualFile dir, IFile.CopyOptions options)Copy file to another directory.voidcopyRecursively(IVirtualFile dest)Copy a directory recursivelyvoidcopyRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveCopyOptions options)Copy a directory recursivelyIVirtualFilecreateDirectory(java.lang.String dirName)Creates a directory under this directoryIVirtualFilecreateFile(java.lang.String filename)Create a file under this directoryvoiddelete()Delete this file.voiddeleteRecursively()Delete all subdirectories and files.voiddeleteRecursively(IVirtualFile.VirtualRecursiveDeleteOptions options)Delete all subdirectories and files.booleanexists()Returns true if this file existsIVirtualFilegetChild(java.lang.String filename)Get a child with this filename.RandomAccessStreamgetInputStream()Retrieves a stream that will be used for reading the file contents.longgetLastDateModified()Returns the last date modified in milliseconds.longgetLength()Return the virtual size of the file.java.lang.StringgetName()Returns the file nameRandomAccessStreamgetOutputStream()Retrieves a stream that will be used for writing the file contents.IVirtualFilegetParent()Returns the virtual parent directory.java.lang.StringgetPath()Return the virtual path for this file.IFilegetRealFile()Return the real filejava.lang.StringgetRealPath()Return the path of the real file.booleanisDirectory()Check if this is a directory.booleanisFile()Check if this is a file.IVirtualFile[]listFiles()Lists files and directories under this directoryvoidmkdir()Create this directory.IVirtualFilemove(IVirtualFile dir)Move file to another directory.IVirtualFilemove(IVirtualFile dir, IFile.MoveOptions options)Move file to another directory.voidmoveRecursively(IVirtualFile dest)Move a directory recursivelyvoidmoveRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveMoveOptions options)Move a directory recursivelyvoidrename(java.lang.String newFilename)Rename the virtual file name
-
-
-
Method Detail
-
getInputStream
RandomAccessStream getInputStream() throws java.io.IOException
Retrieves a stream that will be used for reading the file contents.- Returns:
- The input stream
- Throws:
java.io.IOException- Thrown if there is an IO error.SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.
-
getOutputStream
RandomAccessStream getOutputStream() throws java.io.IOException
Retrieves a stream that will be used for writing the file contents.- Returns:
- The output stream
- Throws:
java.io.IOException- Thrown if there is a problem with the stream.
-
listFiles
IVirtualFile[] listFiles()
Lists files and directories under this directory- Returns:
- An array of files and subdirectories.
-
getChild
IVirtualFile getChild(java.lang.String filename) throws java.io.IOException
Get a child with this filename.- Parameters:
filename- The filename to search for- Returns:
- The child file
- Throws:
SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.java.io.IOException- Thrown if there is an IO error.AuthException- Thrown if there is an Authorization error
-
isFile
boolean isFile()
Check if this is a file.- Returns:
- True if it is a file.
-
isDirectory
boolean isDirectory()
Check if this is a directory.- Returns:
- True if it is a directory.
-
getPath
java.lang.String getPath() throws java.io.IOExceptionReturn the virtual path for this file.- Returns:
- The virtual path.
- Throws:
java.io.IOException- Thrown if there is an IO error.
-
getRealPath
java.lang.String getRealPath()
Return the path of the real file.- Returns:
- The real path.
-
getRealFile
IFile getRealFile()
Return the real file- Returns:
- The real file
-
getName
java.lang.String getName() throws java.io.IOExceptionReturns the file name- Returns:
- The file name
- Throws:
java.io.IOException- if there was a problem with the stream
-
getParent
IVirtualFile getParent()
Returns the virtual parent directory.- Returns:
- The parent directory.
-
delete
void delete()
Delete this file.
-
mkdir
void mkdir()
Create this directory.
-
getLastDateModified
long getLastDateModified()
Returns the last date modified in milliseconds.- Returns:
- The last date modified in milliseconds.
-
getLength
long getLength() throws java.io.IOExceptionReturn the virtual size of the file.- Returns:
- The size in bytes.
- Throws:
java.io.IOException- if there was a problem with the stream
-
exists
boolean exists()
Returns true if this file exists- Returns:
- True if exists.
-
createDirectory
IVirtualFile createDirectory(java.lang.String dirName) throws java.io.IOException
Creates a directory under this directory- Parameters:
dirName- The name of the directory to be created- Returns:
- The new directory.
- Throws:
java.io.IOException- if there was a problem with the stream
-
createFile
IVirtualFile createFile(java.lang.String filename) throws java.io.IOException
Create a file under this directory- Parameters:
filename- The file name.- Returns:
- The new file.
- Throws:
java.io.IOException- if there was a problem with the stream
-
rename
void rename(java.lang.String newFilename) throws java.io.IOExceptionRename the virtual file name- Parameters:
newFilename- The new filename this file will be renamed to- Throws:
java.io.IOException- if there was a problem with the stream
-
move
IVirtualFile move(IVirtualFile dir) throws java.io.IOException
Move file to another directory.- Parameters:
dir- Target directory.- Returns:
- The file
- Throws:
java.io.IOException- Thrown if there is an IO error.
-
move
IVirtualFile move(IVirtualFile dir, IFile.MoveOptions options) throws java.io.IOException
Move file to another directory.- Parameters:
dir- Target directory.options- The options- Returns:
- The file
- Throws:
java.io.IOException- Thrown if there is an IO error.
-
copy
IVirtualFile copy(IVirtualFile dir) throws java.io.IOException
Copy file to another directory.- Parameters:
dir- Target directory.- Returns:
- The file
- Throws:
java.io.IOException- Thrown if there is an IO error.
-
copy
IVirtualFile copy(IVirtualFile dir, IFile.CopyOptions options) throws java.io.IOException
Copy file to another directory.- Parameters:
dir- Target directory.options- The options- Returns:
- The file
- Throws:
java.io.IOException- Thrown if there is an IO error.
-
copyRecursively
void copyRecursively(IVirtualFile dest) throws java.io.IOException
Copy a directory recursively- Parameters:
dest- The destination directory- Throws:
java.io.IOException- Thrown if there is an IO error.
-
copyRecursively
void copyRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveCopyOptions options) throws java.io.IOException
Copy a directory recursively- Parameters:
dest- The destination directoryoptions- The options- Throws:
java.io.IOException- Thrown if there is an IO error.
-
moveRecursively
void moveRecursively(IVirtualFile dest) throws java.io.IOException
Move a directory recursively- Parameters:
dest- The destination directory- Throws:
java.io.IOException- Thrown if there is an IO error.
-
moveRecursively
void moveRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveMoveOptions options) throws java.io.IOException
Move a directory recursively- Parameters:
dest- The destination directoryoptions- The options- Throws:
java.io.IOException- Thrown if there is an IO error.
-
deleteRecursively
void deleteRecursively()
Delete all subdirectories and files.
-
deleteRecursively
void deleteRecursively(IVirtualFile.VirtualRecursiveDeleteOptions options)
Delete all subdirectories and files.- Parameters:
options- The options
-
-