Interface IFileSystemConnection

All Superinterfaces:
IConnection
All Known Implementing Classes:
FileSystemConnection

public interface IFileSystemConnection extends IConnection
A connection that stores data on a file system.
Since:
9.3
Author:
J. Hermus
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    createFile(String path, InputStream stream)
    This method creates a file and writes it to the file system.
    void
    This method creates a new folder relative to the base path.
    void
    This method updates an existing file or otherwise creates it, if it doesn't exist.
    void
    This method deleted a file relative to the base path.
    void
    This method deletes a folder relative to the base path.
    long
    This method returns the size of a file in bytes.
    byte[]
    Returns the entire content of the file into a byte array.
    int
    readBytes(String path, long position, byte[] buffer, int offset, int length)
    Reads up to length bytes of data from a file in this connection into an array of bytes.
    void
    updateFile(String path, InputStream stream)
    This method updates a file, that is relative to the base path.

    Methods inherited from interface com.aquima.interactions.foundation.connectivity.IConnection

    getName, getType
  • Method Details

    • createFile

      void createFile(String path, InputStream stream)
      This method creates a file and writes it to the file system.
      Parameters:
      path - The location where the file needs to be stored, relative to the basePath (cannot be null or an empty String).
      stream - The file as an input stream of bytes that needs to be stored (cannot be null).
      Throws:
      FileException - when a file operation has failed
    • readBytes

      byte[] readBytes(String path)
      Returns the entire content of the file into a byte array.
      Parameters:
      path - The path reference of the file that should be read (cannot be null or an empty String).
      Returns:
      a byte array (never null).
      Throws:
      FileException - when a file operation has failed
    • readBytes

      int readBytes(String path, long position, byte[] buffer, int offset, int length)
      Reads up to length bytes of data from a file in this connection into an array of bytes. The method blocks until some input is available.
      Parameters:
      path - The path reference of the file that should be read (cannot be null or an empty String).
      position - the start offset in the source content.
      buffer - the buffer into which the data is read (may not be null).
      offset - the start offset in the destination array buffer
      length - the maximum number of bytes read.
      Returns:
      the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
      Throws:
      IllegalArgumentException - If path is null or empty, or buffer is null.
      IndexOutOfBoundsException - If position is negative, offset is negative, length is negative, or length is greater than buffer.length - offset
      FileException - If the data cannot be read for any reason
    • getFileSize

      long getFileSize(String path)
      This method returns the size of a file in bytes.
      Parameters:
      path - The path to the file (cannot be null or an empty String).
      Returns:
      The length of the file.
      Throws:
      FileException - If the file size cannot be read for any reason
    • deleteFile

      void deleteFile(String path)
      This method deleted a file relative to the base path.
      Parameters:
      path - The path to the file that needs to be deleted (cannot be null or an empty String).
      Throws:
      FileException - If the file cannot be deleted for any reason
    • updateFile

      void updateFile(String path, InputStream stream)
      This method updates a file, that is relative to the base path.
      Parameters:
      path - The path to the file that needs to be updated or created (cannot be null or an empty String).
      stream - The inputStream that contains the new content (cannot be null).
      Throws:
      FileException - If the file cannot be updated for any reason
    • createOrUpdateFile

      void createOrUpdateFile(String path, InputStream stream)
      This method updates an existing file or otherwise creates it, if it doesn't exist.
      Parameters:
      path - The path to the file that needs to be updated (cannot be null or an empty String).
      stream - The inputStream that contains the new content (cannot be null).
      Throws:
      FileException - If the file cannot be created/updated for any reason
    • createFolder

      void createFolder(String path)
      This method creates a new folder relative to the base path.
      Parameters:
      path - The relative path of the new folder to be created (cannot be null or an empty String).
      Throws:
      FileException - If the folder cannot be created for any reason
    • deleteFolder

      void deleteFolder(String path)
      This method deletes a folder relative to the base path.
      Parameters:
      path - The path to the directory that needs to be removed (cannot be null or an empty String).
      Throws:
      FileException - If the folder cannot be deleted for any reason