Interface MetaFile


public interface MetaFile
Provides an abstraction for a file of a MetaDirectory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    closeTempFile(boolean discard)
    Close the previously opened temporary file. if discard is false, the contents of the temporary file are copied back to this file.
    void
    copyTo(File file, boolean preserveFileDate)
    Copies the contents of this file to the indicated platform file.
    void
    Deletes the file from it's meta directory
    Returns the meta directory that created this file.
    Open an input stream to this file.
    Returns the name of this file.
    Returns a path of this file which is composed of the path of the meta directory and the name of this file.
    Opens a reader using the utf-8 encoding
    long
    Returns the last modified date of this file.
    long
    Returns the length in bytes of this file
    md5()
    Returns the MD5 checksum of this file.
    void
    Moves this file to another meta file of the same directory
    Opens a temporary file that is tied to this file and initializes it with the same content as this file.
  • Method Details

    • getDirectory

      MetaDirectory getDirectory()
      Returns the meta directory that created this file.
      Returns:
      the meta directory.
    • getPath

      String getPath()
      Returns a path of this file which is composed of the path of the meta directory and the name of this file.
      Returns:
      the path
    • getName

      String getName()
      Returns the name of this file.
      Returns:
      the name of this file.
    • getInputStream

      InputStream getInputStream() throws IOException
      Open an input stream to this file.
      Returns:
      an input stream
      Throws:
      IOException - if an I/O error occurs
    • getReader

      Reader getReader() throws IOException
      Opens a reader using the utf-8 encoding
      Returns:
      a read
      Throws:
      IOException - if an I/O error occurs
    • length

      long length()
      Returns the length in bytes of this file
      Returns:
      the length.
    • md5

      MD5 md5() throws IOException
      Returns the MD5 checksum of this file. Note that this operation reads the file fully in order to calculate the checksum.
      Returns:
      the MD5 checksum.
      Throws:
      IOException - if an I/O error occurs
    • lastModified

      long lastModified()
      Returns the last modified date of this file.
      Returns:
      the last modified
    • delete

      void delete() throws IOException
      Deletes the file from it's meta directory
      Throws:
      IOException - if an I/O error occurs
    • openTempFile

      File openTempFile() throws IOException
      Opens a temporary file that is tied to this file and initializes it with the same content as this file.
      Returns:
      a temporary file.
      Throws:
      IOException - if an I/O error occurs
    • closeTempFile

      void closeTempFile(boolean discard) throws IOException
      Close the previously opened temporary file. if discard is false, the contents of the temporary file are copied back to this file.
      Parameters:
      discard - true to discard the changes to the temp file
      Throws:
      IOException - if an I/O error occurs
    • moveTo

      void moveTo(MetaFile dst) throws IOException
      Moves this file to another meta file of the same directory
      Parameters:
      dst - destination file
      Throws:
      IOException - if an I/O error occurs
    • copyTo

      void copyTo(File file, boolean preserveFileDate) throws IOException
      Copies the contents of this file to the indicated platform file.
      Parameters:
      file - destination file
      preserveFileDate - true to update the modification date of the destination file
      Throws:
      IOException - if an I/O error occurs