Class StringConverter

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.EncodingSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, Serializable

    public class StringConverter
    extends AbstractConverter
    implements adams.core.io.EncodingSupporter
    For converting data back into strings.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.core.base.BaseCharset m_Encoding
      the encoding to use.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      StringConverter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      protected Object doConvert​(byte[] payload, adams.core.MessageCollection errors)
      Converts the payload.
      String encodingTipText()
      Returns the tip text for this property.
      Class generates()
      Returns the classes that the converter accepts.
      adams.core.base.BaseCharset getEncoding()
      Returns the encoding to use.
      String getQuickInfo()
      Returns a quick info about the actor, which will be displayed in the GUI.
      String globalInfo()
      Returns a string describing the object.
      void setEncoding​(adams.core.base.BaseCharset value)
      Sets the encoding to use.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • 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_Encoding

        protected adams.core.base.BaseCharset m_Encoding
        the encoding to use.
    • Constructor Detail

      • StringConverter

        public StringConverter()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setEncoding

        public void setEncoding​(adams.core.base.BaseCharset value)
        Sets the encoding to use.
        Specified by:
        setEncoding in interface adams.core.io.EncodingSupporter
        Parameters:
        value - the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
      • getEncoding

        public adams.core.base.BaseCharset getEncoding()
        Returns the encoding to use.
        Specified by:
        getEncoding in interface adams.core.io.EncodingSupporter
        Returns:
        the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
      • encodingTipText

        public String encodingTipText()
        Returns the tip text for this property.
        Specified by:
        encodingTipText in interface adams.core.io.EncodingSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the actor, which will be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class AbstractConverter
        Returns:
        null if no info available, otherwise short string
      • generates

        public Class generates()
        Returns the classes that the converter accepts.
        Specified by:
        generates in class AbstractConverter
        Returns:
        the classes
      • doConvert

        protected Object doConvert​(byte[] payload,
                                   adams.core.MessageCollection errors)
        Converts the payload.
        Specified by:
        doConvert in class AbstractConverter
        Parameters:
        payload - the payload
        errors - for recording errors
        Returns:
        null if failed to convert, otherwise byte array