Class FileBased.DataContainer

  • All Implemented Interfaces:
    adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.SizeOfHandler, Serializable
    Enclosing class:
    FileBased

    public static class FileBased.DataContainer
    extends adams.core.logging.CustomLoggingLevelObject
    Wraps the actual data item with the expiry timestamp.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Date m_Expiry
      the expiry timestamp.
      protected File m_File
      the file containing the data.
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getData()
      Loads the data from disk.
      Date getExpiry()
      Returns the expiry timestamp.
      File getFile()
      Returns the file with the data.
      boolean hasExpired()
      Returns whether the data item has expired and need to be removed.
      • Methods inherited from class adams.core.logging.CustomLoggingLevelObject

        setLoggingLevel
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_File

        protected File m_File
        the file containing the data.
      • m_Expiry

        protected Date m_Expiry
        the expiry timestamp.
    • Constructor Detail

      • DataContainer

        public DataContainer​(File file,
                             Date expiry)
        Initializes the container.
        Parameters:
        file - the data to wrap
        expiry - the expiry timestamp
      • DataContainer

        public DataContainer​(byte[] data,
                             File file,
                             Date expiry)
        Initializes the container.
        Parameters:
        file - the data to wrap
        expiry - the expiry timestamp
    • Method Detail

      • getFile

        public File getFile()
        Returns the file with the data.
        Returns:
        the file
      • getData

        public byte[] getData()
        Loads the data from disk.
        Returns:
        the data, null if failed to load
      • getExpiry

        public Date getExpiry()
        Returns the expiry timestamp.
        Returns:
        the expiry
      • hasExpired

        public boolean hasExpired()
        Returns whether the data item has expired and need to be removed.
        Returns:
        true if expired