Interface TempFileService

All Known Implementing Classes:
TempFileServiceImpl

public interface TempFileService
  • Method Details

    • createTempFile

      Path createTempFile() throws IOException
      Creates a temporary file in the temp directory configured.
      Returns:
      the temporary file
      Throws:
      IOException - if an I/O error occurs
    • createWebAccessibleTempFile

      TempFile createWebAccessibleTempFile(String id, User... permittedUsers) throws IOException
      Creates a web-accessible temporary file which can be retrieved by the given id.
      Parameters:
      id - the web-id of the temporary file.
      permittedUsers - users allowed to access the temporary file
      Returns:
      the web-accessible temp file
      Throws:
      IOException - if an I/O error occurs
    • createWebAccessibleTempFile

      TempFile createWebAccessibleTempFile(User... permittedUsers) throws IOException
      Creates a temporary file which can be retrieved by the returned identifier (TempFile.getWebId()) using the TempFileServlet.
      Parameters:
      permittedUsers - users allowed to access the temporary file
      Throws:
      IOException - if an I/O error occurs
    • getTempFileById

      TempFile getTempFileById(String id)
      Given an identifier (web-id), retrieves the corresponding temporary file.
      Parameters:
      id - the web-id
      Returns:
      the temporary file corresponding to the given web-id
    • readTmpFileIntoByteArray

      byte[] readTmpFileIntoByteArray(Path path) throws IOException
      Reads all bytes of a given temporary file into a byte array. Note that this method is intended for simple cases where it is convenient to read all bytes into a byte array. It is not intended for reading in large files.
      Parameters:
      path - the temporary file to read
      Returns:
      the content of the temporary file as a byte array
      Throws:
      IOException - if an I/O error occurs
    • readTmpFileIntoByteArray

      byte[] readTmpFileIntoByteArray(Path path, boolean removeFile) throws IOException
      Reads all bytes of a given temporary file into a byte array. Note that this method is intended for simple cases where it is convenient to read all bytes into a byte array. It is not intended for reading in large files.
      Parameters:
      path - the temporary file to read
      removeFile - true if the temporary file should be deleted after reading into a byte array
      Returns:
      the content of the temporary file as a byte array
      Throws:
      IOException - if an I/O error occurs
    • isTmpFile

      boolean isTmpFile(Path path)
      Checks if the given file is a temporary file, that is, if is located in a temporary file location.
      Parameters:
      path - the file to check
      Returns:
      true if the given file is a temporary file