com.sun.xml.bind.v2.runtime.unmarshaller

Class Base64Data

public final class Base64Data extends Pcdata

Fed to unmarshaller when the 'text' data is actually a virtual image of base64 encoding of the binary data transferred on the wire. Used for the MTOM support. This object is mutable and the owner of this object can reuse it with new data. Also used by the marshaller to write out the binary data that could be possibly attached.

See Also: text

Field Summary
StringmimeType
Optional MIME type of data.
Method Summary
charcharAt(int index)
Encode this binary data in the base64 encoding and returns the character at the specified position.
byte[]get()
Gets the raw data.
DataHandlergetDataHandler()
Gets the raw data.
intgetDataLen()
byte[]getExact()
Gets the byte[] of the exact length.
InputStreamgetInputStream()
Gets the data as an InputStream.
StringgetMimeType()
booleanhasData()
Returns false if this object only has DataHandler and therefore get operation is likely going to be expensive.
intlength()
Gets the number of characters needed to represent this binary data in the base64 encoding.
voidset(byte[] data, int len, String mimeType)
Fills in the data object by a portion of the byte[].
voidset(byte[] data, String mimeType)
Fills in the data object by the byte[] of the exact length.
voidset(DataHandler data)
Fills in the data object by a DataHandler.
CharSequencesubSequence(int start, int end)
Internally this is only used to split a text to a list, which doesn't happen that much for base64.
StringtoString()
Returns the base64 encoded string of this data.
voidwriteTo(char[] buf, int start)
voidwriteTo(UTF8XmlOutput output)

Field Detail

mimeType

String mimeType
Optional MIME type of data. Unused when dataHandler is set. Use DataHandler#getContentType() in that case.

Method Detail

charAt

public char charAt(int index)
Encode this binary data in the base64 encoding and returns the character at the specified position.

get

public byte[] get()
Gets the raw data. The size of the byte array maybe larger than the actual length.

getDataHandler

public DataHandler getDataHandler()
Gets the raw data.

getDataLen

public int getDataLen()

getExact

public byte[] getExact()
Gets the byte[] of the exact length.

getInputStream

public InputStream getInputStream()
Gets the data as an InputStream.

getMimeType

public String getMimeType()

hasData

public boolean hasData()
Returns false if this object only has DataHandler and therefore get operation is likely going to be expensive.

length

public int length()
Gets the number of characters needed to represent this binary data in the base64 encoding.

set

public void set(byte[] data, int len, String mimeType)
Fills in the data object by a portion of the byte[].

Parameters: len data[0] to data[len-1] are treated as the data.

set

public void set(byte[] data, String mimeType)
Fills in the data object by the byte[] of the exact length.

Parameters: data this buffer may be owned directly by the unmarshaleld JAXB object.

set

public void set(DataHandler data)
Fills in the data object by a DataHandler.

subSequence

public CharSequence subSequence(int start, int end)
Internally this is only used to split a text to a list, which doesn't happen that much for base64. So this method should be smaller than faster.

toString

public String toString()
Returns the base64 encoded string of this data.

writeTo

void writeTo(char[] buf, int start)

writeTo

public void writeTo(UTF8XmlOutput output)