Class JaxbMessageWriter<T extends MessageBase>
- java.lang.Object
-
- com.sportradar.livedata.sdk.proto.common.JaxbMessageWriter<T>
-
- All Implemented Interfaces:
MessageWriter<T>
public class JaxbMessageWriter<T extends MessageBase> extends Object implements MessageWriter<T>
AMessageWriter
implementation which uses JAXB to marshal the messages- Author:
- uros.bregar
-
-
Constructor Summary
Constructors Constructor Description JaxbMessageWriter(JaxbBuilder builder)
Initializes a new instance of theJaxbMessageWriter
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEncoding()
Gets the configured character encoding for the writer.byte[]
write(T message)
Writes the passedmessage
to the returnedbyte[]
-
-
-
Constructor Detail
-
JaxbMessageWriter
public JaxbMessageWriter(JaxbBuilder builder)
Initializes a new instance of theJaxbMessageWriter
class.- Parameters:
builder
- the builder used to build requeiredMarshaller
instances.- Throws:
IllegalArgumentException
- Thebuilder
is a null reference
-
-
Method Detail
-
write
public byte[] write(T message) throws ProtocolException, MessageException
Writes the passedmessage
to the returnedbyte[]
- Specified by:
write
in interfaceMessageWriter<T extends MessageBase>
- Parameters:
message
- The message to be written to the array.- Returns:
- The
byte[]
containing message data. - Throws:
MessageException
- Themessage
could not be written to specified mediaProtocolException
- thrown when an un-expected situation is encountered.
-
getEncoding
public String getEncoding()
Gets the configured character encoding for the writer.- Specified by:
getEncoding
in interfaceMessageWriter<T extends MessageBase>
- Returns:
- - a string, i.e. UTF-8
-
-