Interface Layer


public interface Layer
  • Method Details

    • getId

      long getId()
      Returns the id of the layer.
      Returns:
      the id of the layer
    • close

      void close()
      Changes the state of the layer to closed.
      Throws:
      IllegalStateException - if the layer is already closed
    • reopen

      void reopen() throws IOException
      Changes the state of the layer to open. It also stages the archive file in the staging directory. This operation is not allowed when the layer is not closed or not yet archived.
      Throws:
      IOException
    • isOpen

      boolean isOpen()
      Returns whether the layer is open.
      Returns:
      whether the layer is open
    • archive

      void archive()
      Turns the layer into an archive file.
    • isArchived

      boolean isArchived()
      Returns whether the layer is archived.
      Returns:
      whether the layer is archived
    • createDirectory

      void createDirectory(String path) throws IOException
      Throws:
      IOException
    • deleteDirectory

      void deleteDirectory(String path) throws IOException
      Throws:
      IOException
    • fileExists

      boolean fileExists(String path) throws IOException
      Throws:
      IOException
    • readFile

      InputStream readFile(String path) throws IOException
      Throws:
      IOException
    • writeFile

      void writeFile(String filePath, InputStream content) throws IOException
      Writes the content of the given input stream to the file at the given path. Not allowed when the layer is closed. If the file already exists, it is overwritten.
      Parameters:
      filePath - the path of the file relative to the storage root
      content - the content of the file
      Throws:
      IOException - if the file cannot be written
    • deleteFiles

      void deleteFiles(List<String> paths) throws IOException
      Deletes the files pointed to by paths. Not allowed when the layer is closed.
      Parameters:
      paths - the paths of the files to be deleted
      Throws:
      IOException - if the files cannot be deleted
    • moveDirectoryInto

      void moveDirectoryInto(Path source, String destination) throws IOException
      Throws:
      IOException
    • moveDirectoryInternal

      void moveDirectoryInternal(String source, String destination) throws IOException
      Throws:
      IOException
    • getSizeInBytes

      long getSizeInBytes() throws IOException
      Throws:
      IOException