//-- handle base64 content
Class objType = obj.getClass();
if (objType.isArray() &&
(objType.getComponentType() == Byte.TYPE))
{
MimeBase64Encoder encoder = new MimeBase64Encoder();
encoder.translate((byte[])obj);
chars = encoder.getCharArray();
}
//-- all other types
else {
String str = obj.toString();
if ((str != null) && (str.length() > 0)) {
chars = str.toCharArray();
}
}
if ((chars != null) && (chars.length > 0)) {
try {
handler.characters(chars, 0, chars.length);
}
catch(org.xml.sax.SAXException sx) {
throw new MarshalException(sx);
}
}
}
}
//-- element references
else if (descriptor.isReference()) {
Object id = getObjectID(object);
if (id != null) {
char[] chars = id.toString().toCharArray();
try {
handler.characters(chars, 0, chars.length);
}
catch(org.xml.sax.SAXException sx) {
throw new MarshalException(sx);
}
}
}
// special case for byte[]
else if (byteArray) {
//-- Base64Encoding
MimeBase64Encoder encoder = new MimeBase64Encoder();
encoder.translate((byte[])object);
char[] chars = encoder.getCharArray();
try {
handler.characters(chars, 0, chars.length);
}
catch(org.xml.sax.SAXException sx) {
throw new MarshalException(sx);