Class EcmStorage

  • All Implemented Interfaces:
    IStorage

    @Singleton
    public class EcmStorage
    extends Object
    implements IStorage
    The EcmStorage class provides an IStorage implementation for the SAP HANA Cloud Document Service.
    • Constructor Detail

      • EcmStorage

        public EcmStorage()
        Constructs a new EcmStorage object.
    • Method Detail

      • createFolder

        public void createFolder​(String path)
                          throws IOException
        Description copied from interface: IStorage
        Creates a folder.
        Specified by:
        createFolder in interface IStorage
        Parameters:
        path - the path of the new folder
        Throws:
        IOException - if an error occurred while accessing the storage
      • writeFile

        public void writeFile​(String path,
                              byte[] data)
                       throws IOException
        Description copied from interface: IStorage
        Writes data to the specified file. The file will be overwritten if it already exists.
        Specified by:
        writeFile in interface IStorage
        Parameters:
        path - the destination path
        data - a byte array containing the data to write
        Throws:
        IOException - if an error occurred while accessing the storage
      • writeFile

        public void writeFile​(String path,
                              String data)
                       throws IOException
        Description copied from interface: IStorage
        Writes data to the specified file. The file will be overwritten if it already exists.
        Specified by:
        writeFile in interface IStorage
        Parameters:
        path - the destination path
        data - a string containing the data to write
        Throws:
        IOException - if an error occurred while accessing the storage
      • readFile

        public byte[] readFile​(String path)
                        throws FileNotFoundException
        Description copied from interface: IStorage
        Reads the content of the specified file.
        Specified by:
        readFile in interface IStorage
        Parameters:
        path - the path to the file whose content will be read
        Returns:
        a byte array containing the file content
        Throws:
        FileNotFoundException - if the file could not be found
      • getFiles

        public Set<String> getFiles​(String path)
                             throws IOException
        Description copied from interface: IStorage
        Gets the files and folders contained in the specified folder.
        Specified by:
        getFiles in interface IStorage
        Parameters:
        path - the path whose files and folders will be returned
        Returns:
        a set of file and folder names
        Throws:
        IOException - if an error occurred while accessing the storage
      • deleteFile

        public void deleteFile​(String path)
        Description copied from interface: IStorage
        Deletes the specified file or folder.
        Specified by:
        deleteFile in interface IStorage
        Parameters:
        path - the file or folder to delete
      • isFolder

        public boolean isFolder​(String path)
        Description copied from interface: IStorage
        Checks whether the specified path points to a folder.
        Specified by:
        isFolder in interface IStorage
        Parameters:
        path - the path to check
        Returns:
        true if the path points to a folder, otherwise false
      • fileExists

        public boolean fileExists​(String path)
        Description copied from interface: IStorage
        Checks whether the specified path points to an existing file or folder.
        Specified by:
        fileExists in interface IStorage
        Parameters:
        path - the path to check
        Returns:
        true if the file or folder exists, otherwise false