Interface FileSystem

All Known Implementing Classes:
BaseFileSystem

public interface FileSystem
A repository is just a type of file system.
Since:
1.0
  • Method Details

    • listEntries

      Entry[] listEntries(DirectoryEntry directory)
      Lists the entries in the specified directory. Some implementations may be lazy caching implementations, in which case it is permitted to return either an empty array, or only those entries which have been loaded into the cache, so consumers should not assume that a missing entry implies non-existence. The only way to be sure that an artifact does not exist is to call the FileEntry.getInputStream() method, although get(String) returning null is also definitive, a non-null does not prove existence).
      Parameters:
      directory - the directory to list the entries of.
      Returns:
      a copy of the known entries in the specified directory, never null. The caller can safely modify the returned array.
      Since:
      1.0
    • getRoot

      DirectoryEntry getRoot()
      Returns the root directory entry.
      Returns:
      the root directory entry.
      Since:
      1.0
    • get

      Entry get(String path)
      Returns the entry at the specified path. A null result proves the path does not exist, however very lazy caching implementations may return a non-null entry for paths which do not exist.
      Parameters:
      path - the path to retrieve the Entry of.
      Returns:
      the Entry or null if the path definitely does not exist.
      Since:
      1.0
    • getLastModified

      long getLastModified(DirectoryEntry entry) throws IOException
      Returns the time that the specified directory entry was last modified. Note: DefaultDirectoryEntry.getLastModified() delegates to this method.
      Parameters:
      entry - the directory entry.
      Returns:
      A long value representing the time the directory was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the the time is unknown.
      Throws:
      IOException - if an I/O error occurs.
      Since:
      1.0
    • put

      FileEntry put(DirectoryEntry parent, String name, InputStream content) throws IOException
      Puts the specified content into a the specified directory.
      Parameters:
      parent - the directory in which the content is to be created/updated.
      name - the name of the file.
      content - the content (implementer is responsible for closing).
      Returns:
      the FileEntry that was created/updated.
      Throws:
      UnsupportedOperationException - if the repository is read-only.
      IOException - if the content could not be read/written.
      Since:
      1.0