Package storage

Class FileLoaderWriter

java.lang.Object
storage.FileLoaderWriter
All Implemented Interfaces:
Storage

public class FileLoaderWriter extends Object implements Storage
  • Constructor Details

    • FileLoaderWriter

      public FileLoaderWriter()
  • Method Details

    • readFile

      public HashMap<String,byte[]> readFile(String[] extensions, String description) throws Exception
      Allows the user to choose media to be added to the Page
      Specified by:
      readFile in interface Storage
      Parameters:
      extensions - file extensions accepted by the file chooser
      description - text to be displayed in the file chooser
      Returns:
      A map of the name of the read file to the raw bytes stored by it
      Throws:
      Exception - when an error occurs reading the file
    • writeFile

      public URI writeFile(String name, byte[] Data, String extension) throws Exception
      Writes a temp file for use by FileMedia
      Specified by:
      writeFile in interface Storage
      Parameters:
      name - what the temp file will be called
      Data - the raw data to be written
      extension - the extension type the written temp file will be. Must be in form '.extensionType'
      Returns:
      a URI indentfying the temp file that was written
      Throws:
      Exception - when writing fails for any reason