Package com.solace.serdes
Class StringDeserializer
- java.lang.Object
-
- com.solace.serdes.StringDeserializer
-
- All Implemented Interfaces:
Deserializer<String>
,Closeable
,AutoCloseable
public class StringDeserializer extends Object implements Deserializer<String>
A deserializer for converting byte[] to strings using a specified character encoding.
-
-
Field Summary
Fields Modifier and Type Field Description static String
SOLACE_DESERIALIZER_STRING_ENCODING
-
Constructor Summary
Constructors Constructor Description StringDeserializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Map<String,?> properties)
Configures thisStringDeserializer
with the given properties.String
deserialize(String destinationName, byte[] payload)
Deserializes the given byte[] to string using the configured character encoding.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.solace.serdes.Deserializer
close, deserialize
-
-
-
-
Field Detail
-
SOLACE_DESERIALIZER_STRING_ENCODING
public static final String SOLACE_DESERIALIZER_STRING_ENCODING
- See Also:
- Constant Field Values
-
-
Method Detail
-
configure
public void configure(Map<String,?> properties)
Configures thisStringDeserializer
with the given properties.NOTE: The default encoding is UTF-8.
- Specified by:
configure
in interfaceDeserializer<String>
- Parameters:
properties
- a map of configuration properties- Throws:
IllegalArgumentException
- if the charset encoding type is unsupported or the specified charset is unsupported, or when properties is null.
-
deserialize
public String deserialize(String destinationName, byte[] payload)
Deserializes the given byte[] to string using the configured character encoding.NOTE: The default encoding is UTF-8.
- Specified by:
deserialize
in interfaceDeserializer<String>
- Parameters:
destinationName
- the name of the destination (not used in this implementation)payload
- the byte[] to deserialize- Returns:
- the deserialized String, or null if the input payload is null
-
-