Interface IVirtualFile

All Known Implementing Classes:
AesFile

public interface IVirtualFile
A 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.
  • Method Details

    • getInputStream

      RandomAccessStream getInputStream() throws IOException
      Retrieves a stream that will be used for reading the file contents.
      Returns:
      The input stream
      Throws:
      IOException - Thrown if there is an IO error.
    • getOutputStream

      RandomAccessStream getOutputStream() throws IOException
      Retrieves a stream that will be used for writing the file contents.
      Returns:
      The output stream
      Throws:
      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(String filename) throws IOException
      Get a child with this filename.
      Parameters:
      filename - The filename to search for
      Returns:
      The child file
      Throws:
      IOException - Thrown if there is an exception.
    • 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

      String getPath() throws IOException
      Return the virtual path for this file.
      Returns:
      The virtual path.
      Throws:
      IOException - Thrown if there is an IO error.
    • getRealPath

      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

      String getName() throws IOException
      Returns the file name
      Returns:
      The file name
      Throws:
      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 IOException
      Return the virtual size of the file.
      Returns:
      The size in bytes.
      Throws:
      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(String dirName) throws IOException
      Creates a directory under this directory
      Parameters:
      dirName - The name of the directory to be created
      Returns:
      The new directory.
      Throws:
      IOException - if there was a problem with the stream
    • createFile

      IVirtualFile createFile(String filename) throws IOException
      Create a file under this directory
      Parameters:
      filename - The file name.
      Returns:
      The new file.
      Throws:
      IOException - if there was a problem with the stream
    • rename

      void rename(String newFilename) throws IOException
      Rename the virtual file name
      Parameters:
      newFilename - The new filename this file will be renamed to
      Throws:
      IOException - if there was a problem with the stream
    • move

      Move file to another directory.
      Parameters:
      dir - Target directory.
      Returns:
      The file
      Throws:
      IOException - Thrown if there is an IO error.
    • move

      Move file to another directory.
      Parameters:
      dir - Target directory.
      options - The options
      Returns:
      The file
      Throws:
      IOException - Thrown if there is an IO error.
    • copy

      Copy file to another directory.
      Parameters:
      dir - Target directory.
      Returns:
      The file
      Throws:
      IOException - Thrown if there is an IO error.
    • copy

      Copy file to another directory.
      Parameters:
      dir - Target directory.
      options - The options
      Returns:
      The file
      Throws:
      IOException - Thrown if there is an IO error.
    • copyRecursively

      void copyRecursively(IVirtualFile dest) throws IOException
      Copy a directory recursively
      Parameters:
      dest - The destination directory
      Throws:
      IOException - Thrown if there is an IO error.
    • copyRecursively

      void copyRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveCopyOptions options) throws IOException
      Copy a directory recursively
      Parameters:
      dest - The destination directory
      options - The options
      Throws:
      IOException - Thrown if there is an IO error.
    • moveRecursively

      void moveRecursively(IVirtualFile dest) throws IOException
      Move a directory recursively
      Parameters:
      dest - The destination directory
      Throws:
      IOException - Thrown if there is an IO error.
    • moveRecursively

      void moveRecursively(IVirtualFile dest, IVirtualFile.VirtualRecursiveMoveOptions options) throws IOException
      Move a directory recursively
      Parameters:
      dest - The destination directory
      options - The options
      Throws:
      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