public class Base64Data extends Object implements CharSequence, Cloneable
Used in conjunction with XMLStreamReaderEx
and XMLStreamWriterEx
.
Constructor and Description |
---|
Base64Data()
Default constructor
|
Base64Data(Base64Data that)
Clone constructor
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index)
Encode this binary data in the base64 encoding
and returns the character at the specified position.
|
Base64Data |
clone() |
byte[] |
get()
Gets the raw data.
|
DataHandler |
getDataHandler()
Gets the raw data.
|
int |
getDataLen()
Gets the length of the binary data counted in bytes.
|
byte[] |
getExact()
Gets the byte[] of the exact length.
|
String |
getHrefCid() |
InputStream |
getInputStream()
Gets the data as an
InputStream . |
String |
getMimeType() |
boolean |
hasData()
Returns false if this object only has
DataHandler and therefore
get() operation is likely going to be expensive. |
int |
length()
Gets the number of characters needed to represent
this binary data in the base64 encoding.
|
void |
set(byte[] data,
int len,
String mimeType)
Fills in the data object by a portion of the byte[].
|
void |
set(byte[] data,
int len,
String mimeType,
boolean cloneByRef)
Fills in the data object by a portion of the byte[].
|
void |
set(byte[] data,
String mimeType)
Fills in the data object by the byte[] of the exact length.
|
void |
set(DataHandler data)
Fills in the data object by a
DataHandler . |
void |
setHrefCid(String cid) |
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.
|
String |
toString()
Returns the base64 encoded string of this data.
|
void |
writeTo(char[] buf,
int start) |
void |
writeTo(XMLStreamWriter output) |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chars, codePoints
public Base64Data()
public Base64Data(Base64Data that)
that
- needs to be clonedpublic void set(byte[] data, int len, String mimeType, boolean cloneByRef)
data
- actual datalen
- data[0] to data[len-1] are treated as the data.mimeType
- MIME typecloneByRef
- true if data[] can be cloned by referencepublic void set(byte[] data, int len, String mimeType)
data
- actual data byteslen
- data[0] to data[len-1] are treated as the data.mimeType
- MIME typepublic void set(byte[] data, String mimeType)
data
- this buffer may be owned directly by the unmarshaleld JAXB object.mimeType
- MIME typepublic void set(DataHandler data)
DataHandler
.data
- DataHandler for the datapublic DataHandler getDataHandler()
StreamingDataHandler
,
callees may need to downcast to take advantage of its capabilities.StreamingDataHandler
public byte[] getExact()
public InputStream getInputStream() throws IOException
InputStream
.IOException
- if i/o error occurspublic boolean hasData()
DataHandler
and therefore
get()
operation is likely going to be expensive.public byte[] get()
public int getDataLen()
DataHandler
,
this method would have to read the whole thing into byte[]
just to count the length, because DataHandler
doesn't easily expose the length.public String getMimeType()
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
public void writeTo(char[] buf, int start)
public void writeTo(XMLStreamWriter output) throws IOException, XMLStreamException
IOException
XMLStreamException
public Base64Data clone()
public String getHrefCid()
public void setHrefCid(String cid)
Copyright © 2021 JBoss by Red Hat. All rights reserved.