Interface FileStore

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
ImageTileDiskCache

public interface FileStore extends Closeable
An interface for providing read access to files.
Since:
3.2.0
Author:
Joel Uckelman
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the store.
    boolean
    Queries whether a file exists in the store.
    Gets the list of files in the store.
    Gets the list of files under a given directory of the store.
    Gets an InputStream to read from the given file.
    long
    Gets the modification time of a file in the store, in milliseconds since the epoch.
    long
    Gets the size of a file in the store, in bytes.
    boolean
    Checks whether the store is closed.
  • Method Details

    • contains

      boolean contains(String path) throws IOException
      Queries whether a file exists in the store.
      Parameters:
      path - the path to the file in the store
      Returns:
      true if the file exists in the store
      Throws:
      IOException - oops
    • getInputStream

      InputStream getInputStream(String path) throws IOException
      Gets an InputStream to read from the given file.
      Parameters:
      path - the path to the file in the store
      Returns:
      an InputStream containing the requested file
      Throws:
      IOException - oops
    • getSize

      long getSize(String path) throws IOException
      Gets the size of a file in the store, in bytes.
      Parameters:
      path - the path to the file in the store
      Returns:
      the size of the file, in bytes
      Throws:
      FileNotFoundException - if path is not in the store
      IOException - oops
    • getMTime

      long getMTime(String path) throws IOException
      Gets the modification time of a file in the store, in milliseconds since the epoch.
      Parameters:
      path - the path to the file in the store
      Returns:
      the mtime of the file
      Throws:
      FileNotFoundException - if path is not in the store
      IOException - oops
    • getFiles

      List<String> getFiles() throws IOException
      Gets the list of files in the store.
      Returns:
      the list of files in the store
      Throws:
      IOException - oops
    • getFiles

      List<String> getFiles(String root) throws IOException
      Gets the list of files under a given directory of the store.
      Parameters:
      root - the directory
      Returns:
      the list of files under the given directory
      Throws:
      FileNotFoundException - if root is not in the store
      IOException - oops
    • close

      void close() throws IOException
      Closes the store.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - oops
    • isClosed

      boolean isClosed()
      Checks whether the store is closed.
      Returns:
      true if the archive is closed