@Immutable public class XmlCodec extends Object implements Codec
XMLEncoder/XMLDecoder.
This type of codec is used for V1 format license keys.
| Constructor and Description |
|---|
XmlCodec() |
| Modifier and Type | Method and Description |
|---|---|
String |
contentTransferEncoding()
Returns an identifier for the content transfer encoding used by this
codec.
|
String |
contentType()
Returns an identifier for the content type used by this codec.
|
<T> T |
decode(Source source,
Type expected)
Decodes a nullable object graph from the given source.
|
protected XMLDecoder |
decoder(InputStream in)
Returns a new XML decoder.
|
void |
encode(Sink sink,
Object obj)
Encodes a nullable object graph to the given sink.
|
protected XMLEncoder |
encoder(OutputStream out)
Returns a new XML encoder.
|
public String contentTransferEncoding()
If the Content-Transfer-Encoding equals (ignoring case) "8bit"
and the Content-Type does not specify a
charset parameter, then UTF-8 is assumed as the charset.
The implementation in the class XmlCodec
returns "8bit".
contentTransferEncoding in interface Codecpublic String contentType()
The implementation in the class XmlCodec
returns "application/xml; charset=utf-8".
contentType in interface Codec@Nullable public <T> T decode(Source source, Type expected) throws Exception
Codecdecode in interface CodecT - the expected generic type of the decoded object.source - the source from where to read the encoded object graph
from.expected - the expected generic type of the decoded object graph,
e.g. String.class.
This is just a hint and the implementation may ignore it.null if and only if the original object graph
was null.Exceptionprotected XMLDecoder decoder(InputStream in)
public void encode(Sink sink, @Nullable Object obj) throws Exception
Codecprotected XMLEncoder encoder(OutputStream out)
Copyright © 2005–2017 Schlichtherle IT Services. All rights reserved.