Class: com.sun.xml.internal.bind.v2.runtime.unmarshaller.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.
Inheritance
Superclass tree:- java.lang.Object
- com.sun.xml.internal.bind.v2.runtime.output.Pcdata
- com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data
Methods
-
Base64Datatop
public Base64Data() -
charAttop
public char charAt(int index)Encode this binary data in the base64 encoding and returns the character at the specified position.- Specified by:
- charAt from CharSequence
-
gettop
public byte[] get()Gets the raw data. The size of the byte array maybe larger than the actual length. -
getDataHandlertop
public DataHandler getDataHandler()Gets the raw data. -
getDataLentop
public int getDataLen() -
getExacttop
public byte[] getExact()Gets the byte[] of the exact length. -
getInputStreamtop
public InputStream getInputStream() throws IOExceptionGets the data as an java.io.InputStream. -
getMimeTypetop
public String getMimeType() -
hasDatatop
public boolean hasData()Returns false if this object only has javax.activation.DataHandler and therefore com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data.get() operation is likely going to be expensive. -
lengthtop
public int length()Gets the number of characters needed to represent this binary data in the base64 encoding.- Specified by:
- length from CharSequence
-
settop
public void set(DataHandler data)Fills in the data object by a javax.activation.DataHandler. -
settop
public void set(byte[] data, int len, String mimeType)Fills in the data object by a portion of the byte[]. -
settop
public void set(byte[] data, String mimeType)Fills in the data object by the byte[] of the exact length. -
subSequencetop
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.- Specified by:
- subSequence from CharSequence
-
toStringtop
public String toString()Returns the base64 encoded string of this data.- Specified by:
- toString from CharSequence
-
writeTotop
public void writeTo(UTF8XmlOutput output) throws IOExceptionWrites itself to com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput.This is the most performance critical path for the marshaller, so it warrants its own method.
-
writeTotop
public void writeTo(char[] buf, int start)Writes itself to the character array.This method is used by most other com.sun.xml.internal.bind.v2.runtime.output.XmlOutput. The default implementation involves in one extra char[] copying.
The caller must provide a big enough buffer that can hold enough characters returned by the CharSequence.length() method.
Fields
-
data
private byte[] data -
dataHandler
private DataHandler dataHandler -
dataLen
private int dataLenLength of the valid data in com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data.data. -
mimeType
Optional MIME type of com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data.data. Unused when com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data.dataHandler is set. Use javax.activation.DataHandler.getContentType() in that case.
