Class AbstractFileStorage<K,​V>

  • Type Parameters:
    K - DataType of key which is used to save value
    V - DataType of objects which should be stored
    All Implemented Interfaces:
    Storage<K,​V>
    Direct Known Subclasses:
    GenericFileStorage

    public abstract class AbstractFileStorage<K,​V>
    extends Object
    implements Storage<K,​V>

    Abstract Implementation of Storage Interface for storing objects in the TEMP folder of the file system

    Since:
    2.0
    Author:
    Christoph Praschl
    • Field Detail

      • pathToTempFolder

        protected final String pathToTempFolder
      • completePath

        protected final String completePath
      • fileExtension

        protected final String fileExtension
    • Constructor Detail

      • AbstractFileStorage

        public AbstractFileStorage​(String pathToSubFolder,
                                   String fileExtension)
      • AbstractFileStorage

        public AbstractFileStorage​(String pathToSubFolder,
                                   String fileExtension,
                                   String subFolder)
    • Method Detail

      • getPath

        public String getPath()
        Method for getting the storage path
        Returns:
        Storage path
      • getFileExtension

        public String getFileExtension()
        Method for getting used file extension of storage
        Returns:
        File extension
      • buildPath

        protected String buildPath​(String filename,
                                   String extension)
        Method for building path with given filename
        Parameters:
        filename - name of file at internal path (without file extension!)
        extension - file extension
        Returns:
        Complete path containing the name of the .txt file
      • buildPath

        protected String buildPath​(String filename)
        Method for building path with given filename
        Parameters:
        filename - name of file at internal path (without file extension!)
        Returns:
        Complete path containing the name of the .txt file
      • generateStringToken

        protected String generateStringToken()
        Method for generating a random string key
        Returns:
        Random string key with 32 letters