Class Socket
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.standalone.rats.output.AbstractRatOutput
-
- adams.flow.standalone.rats.output.Socket
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.ShallowCopySupporter<AbstractRatOutput>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,adams.event.VariableChangeListener
,RatOutput
,Serializable
public class Socket extends AbstractRatOutput
Just outputs the data to the specified socket.
Any incoming data that isn't a byte array gets converted to a string and its bytes (using the specified encoding) are then transmitted.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-address <adams.core.base.BaseHostname> (property: address) The address to connect to. default: 127.0.0.1:8000
-encoding <adams.core.base.BaseCharset> (property: encoding) The type of encoding for sending the data. default: Default
- 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.BaseHostname
m_Address
the address to open.protected boolean
m_CloseAfterSend
whether to close the socket after sending data.protected adams.core.base.BaseCharset
m_Encoding
the encoding to use.protected Socket
m_Socket
the socket to use.-
Fields inherited from class adams.flow.standalone.rats.output.AbstractRatOutput
m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_Input, m_LoggingPrefix, m_Owner, m_Stopped, m_VariablesUpdated
-
-
Constructor Summary
Constructors Constructor Description Socket()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the type of data that gets accepted.String
addressTipText()
Returns the tip text for this property.void
cleanUp()
Cleans up data structures, frees up memory.String
closeAfterSendTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
doTransmit()
Performs the actual transmission.String
encodingTipText()
Returns the tip text for this property.adams.core.base.BaseHostname
getAddress()
Returns the address.boolean
getCloseAfterSend()
Returns whether to close the socket after sending the data.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
setAddress(adams.core.base.BaseHostname value)
Sets the address.void
setCloseAfterSend(boolean value)
Sets whether to close the socket after sending the data.void
setEncoding(adams.core.base.BaseCharset value)
Sets the encoding to use.-
Methods inherited from class adams.flow.standalone.rats.output.AbstractRatOutput
backupState, canInput, check, configureLogger, doWait, findVariables, getAdditionalInformation, getFullName, getOwner, getQueue, getVariables, handleException, initialize, initTransmission, input, isBackedUp, isStopped, pruneBackup, pruneBackup, restoreState, setOwner, setUp, shallowCopy, shallowCopy, stopExecution, transmit, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Address
protected adams.core.base.BaseHostname m_Address
the address to open.
-
m_Encoding
protected adams.core.base.BaseCharset m_Encoding
the encoding to use.
-
m_CloseAfterSend
protected boolean m_CloseAfterSend
whether to close the socket after sending data.
-
m_Socket
protected transient Socket m_Socket
the socket to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
setAddress
public void setAddress(adams.core.base.BaseHostname value)
Sets the address.- Parameters:
value
- the address
-
getAddress
public adams.core.base.BaseHostname getAddress()
Returns the address.- Returns:
- the address
-
addressTipText
public String addressTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setEncoding
public void setEncoding(adams.core.base.BaseCharset value)
Sets the encoding to use.- 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.- 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.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCloseAfterSend
public void setCloseAfterSend(boolean value)
Sets whether to close the socket after sending the data.- Parameters:
value
- true if to close socket
-
getCloseAfterSend
public boolean getCloseAfterSend()
Returns whether to close the socket after sending the data.- Returns:
- true if to close socket
-
closeAfterSendTipText
public String closeAfterSendTipText()
Returns the tip text for this property.- 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 interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractRatOutput
- Returns:
- null if no info available, otherwise short string
-
accepts
public Class[] accepts()
Returns the type of data that gets accepted.- Specified by:
accepts
in interfaceRatOutput
- Specified by:
accepts
in classAbstractRatOutput
- Returns:
- the type of data
-
doTransmit
protected String doTransmit()
Performs the actual transmission.- Specified by:
doTransmit
in classAbstractRatOutput
- Returns:
- null if successful, otherwise error message
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
- Overrides:
cleanUp
in classAbstractRatOutput
-
-