Interface Store

All Known Implementing Classes:
FileSystemStore, S3Store

public interface Store
Represents an interface for managing file storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    default UploadedFile
    addFile(File file, String fileName)
    Adds a file to the store using the specified file and file name.
    addFile(InputStream inputStream, String fileName)
    Adds a file to the store using the provided input stream and file name.
    addFile(Path path, String fileName)
    Adds a file to the store using the specified file path and file name.
    void
    deleteFile(String fileName)
    Deletes a file with the specified name from the store.
    default File
    getFile(String fileName)
    Retrieves a File representation of the specified file in the store.
    default File
    getFile(String fileName, boolean cache)
    Retrieves a File representation of the specified file in the store.
    default Path
    getPath(String fileName)
    Retrieves a Path representation of the specified file in the store.
    getPath(String fileName, boolean cache)
    Retrieves a Path representation of the specified file in the store.
    Retrieves the type of store being used.
    default InputStream
    getStream(String fileName)
    Retrieves an input stream for the specified file.
    getStream(String fileName, boolean cache)
    Retrieves an input stream for the specified file.
    boolean
    hasFile(String fileName)
    Checks if a file with the specified name exists in the store.
    void
    Performs the necessary cleanup or resource release operations to gracefully shut down the storage.
  • Method Details

    • hasFile

      boolean hasFile(String fileName)
      Checks if a file with the specified name exists in the store.
      Parameters:
      fileName - the name of the file to check for existence
      Returns:
      true if a file with the specified name exists, false otherwise
    • addFile

      UploadedFile addFile(InputStream inputStream, String fileName)
      Adds a file to the store using the provided input stream and file name.
      Parameters:
      inputStream - the input stream containing the file data
      fileName - the name of the file to be stored
      Returns:
      an UploadedFile object representing the details of the uploaded file
    • addFile

      UploadedFile addFile(Path path, String fileName)
      Adds a file to the store using the specified file path and file name.
      Parameters:
      path - the Path of the file to be added
      fileName - the name under which the file should be stored
      Returns:
      an UploadedFile object containing the details of the uploaded file
    • addFile

      default UploadedFile addFile(File file, String fileName)
      Adds a file to the store using the specified file and file name.
      Parameters:
      file - the File object to be added to the store
      fileName - the name under which the file should be stored
      Returns:
      an UploadedFile object containing the details of the uploaded file
    • deleteFile

      void deleteFile(String fileName)
      Deletes a file with the specified name from the store.
      Parameters:
      fileName - the name of the file to be deleted
    • getPath

      default Path getPath(String fileName)
      Retrieves a Path representation of the specified file in the store.
      Parameters:
      fileName - the name of the file whose path is to be retrieved
      Returns:
      the Path object representing the storage location of the file
    • getPath

      Path getPath(String fileName, boolean cache)
      Retrieves a Path representation of the specified file in the store.
      Parameters:
      fileName - the name of the file whose path is to be retrieved
      cache - whether to use cached storage for retrieving the file path
      Returns:
      the Path object representing the storage location of the file
    • getFile

      default File getFile(String fileName)
      Retrieves a File representation of the specified file in the store.
      Parameters:
      fileName - the name of the file to retrieve
      Returns:
      the File object representing the specified file, or null if the file does not exist
    • getFile

      default File getFile(String fileName, boolean cache)
      Retrieves a File representation of the specified file in the store.
      Parameters:
      fileName - the name of the file to retrieve
      cache - whether to use cached storage for retrieving the file
      Returns:
      the File object representing the specified file, or null if the file does not exist
    • getStream

      default InputStream getStream(String fileName)
      Retrieves an input stream for the specified file.
      Parameters:
      fileName - the name of the file to retrieve the input stream for
      Returns:
      an InputStream for the specified file
    • getStream

      InputStream getStream(String fileName, boolean cache)
      Retrieves an input stream for the specified file.
      Parameters:
      fileName - the name of the file to retrieve the input stream for
      cache - whether the file should be retrieved from a cached source
      Returns:
      an InputStream for the specified file
    • getStoreType

      StoreType getStoreType()
      Retrieves the type of store being used.
      Returns:
      the StoreType representing the type of storage
    • shutdown

      void shutdown()
      Performs the necessary cleanup or resource release operations to gracefully shut down the storage.