Class LocalStorageProvider

java.lang.Object
dev.jensderuiter.minecraft_imagery.storage.LocalStorageProvider
All Implemented Interfaces:
StorageProvider

public class LocalStorageProvider extends Object implements StorageProvider
  • Constructor Details

    • LocalStorageProvider

      public LocalStorageProvider()
      Initialize the Local storage provider. This saves images to the storage/ folder inside the plugin data folder.
  • Method Details

    • fetch

      public BufferedImage fetch(UUID uuid) throws StorageException
      Fetch an image from the local storage. Image is in PNG format (TYPE_INT_ARGB).
      Specified by:
      fetch in interface StorageProvider
      Parameters:
      uuid - The UUID of the image to fetch. You have saved this from the store method.
      Returns:
      The image with the specified UUID.
      Throws:
      StorageException - When the fetching fails.
    • store

      public UUID store(BufferedImage image) throws StorageException
      Store an image in the local storage. Will be stored as (generated uuid).png
      Specified by:
      store in interface StorageProvider
      Parameters:
      image - The image to store.
      Returns:
      The UUID of the image you've just stored. Used to retrieve or remove the image.
      Throws:
      StorageException - When storing the image fails.
    • remove

      public void remove(UUID uuid) throws StorageException
      Remove an image from the S3 bucket.
      Specified by:
      remove in interface StorageProvider
      Parameters:
      uuid - The UUID of the image to remove. You have saved this from the store method.
      Throws:
      StorageException - When the deletion fails. Permissions? Already gone?
    • getFileName

      public String getFileName(String fileName)
      Specified by:
      getFileName in interface StorageProvider