Top Description Fields Constructors Methods
com.thoughtworks.xstream.core.util

public Class Base64JavaUtilCodec

extends Object
implements StringCodec
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.core.StringCodec
Imports
java.util.Base64, com.thoughtworks.xstream.core.StringCodec

Base64 codec implementation based on java.util.Base64.
Author
Jörg Schaible
Since
1.4.11

Field Summary

Modifier and TypeField and Description
private final Base64.Decoder
private final Base64.Encoder

Constructor Summary

AccessConstructor and Description
public
Base64JavaUtilCodec()

Constructs a Base64JavaUtilCodec.

public
Base64JavaUtilCodec(final Base64.Encoder
the encoder instance
encoder
,
final Base64.Decoder
the decoder instance
decoder
)

Constructs a Base64JavaUtilCodec with provided encoder and decoder.

Method Summary

Modifier and TypeMethod and Description
public byte[]
decode(final String
the encoded string
base64
)

Implements com.thoughtworks.xstream.core.StringCodec.decode.

Decode the provided encoded string.
public String
encode(final byte[]
the data to encode
data
)

Implements com.thoughtworks.xstream.core.StringCodec.encode.

Encode the provided data.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decoderback to summary
private final Base64.Decoder decoder
encoderback to summary
private final Base64.Encoder encoder

Constructor Detail

Base64JavaUtilCodecback to summary
public Base64JavaUtilCodec()

Constructs a Base64JavaUtilCodec.

The implementation will use a basic encoder and a MIME decoder by default.

Since
1.4.11
Base64JavaUtilCodecback to summary
public Base64JavaUtilCodec(final Base64.Encoder encoder, final Base64.Decoder decoder)

Constructs a Base64JavaUtilCodec with provided encoder and decoder.

Parameters
encoder:Base64.Encoder

the encoder instance

decoder:Base64.Decoder

the decoder instance

Since
1.4.11

Method Detail

decodeback to summary
public byte[] decode(final String base64)

Implements com.thoughtworks.xstream.core.StringCodec.decode.

Doc from com.thoughtworks.xstream.core.StringCodec.decode.

Decode the provided encoded string.

Parameters
base64:String

the encoded string

Returns:byte[]

the decoded data

Annotations
@Override
encodeback to summary
public String encode(final byte[] data)

Implements com.thoughtworks.xstream.core.StringCodec.encode.

Doc from com.thoughtworks.xstream.core.StringCodec.encode.

Encode the provided data.

Parameters
data:byte[]

the data to encode

Returns:String

the data encoded as string

Annotations
@Override