下面列出了 org.apache.commons.codec.binary.Base64OutputStream # write ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
baaos.reset();
Base64OutputStream b64os = new Base64OutputStream(baaos, false);
b64os.write(stringp.getByteArray(), stringp.getCharStartOffset(), stringp.getUTF8Length());
dOut.write(ValueTag.XS_BASE64_BINARY_TAG);
dOut.write((byte) ((baaos.size() >>> 8) & 0xFF));
dOut.write((byte) ((baaos.size() >>> 0) & 0xFF));
dOut.write(baaos.getByteArray(), 0, baaos.size());
b64os.close();
}
@Override
public void convertBase64Binary(XSBinaryPointable binaryp, DataOutput dOut) throws SystemException, IOException {
// Read binary
Base64OutputStream b64os = new Base64OutputStream(baaos, true);
b64os.write(binaryp.getByteArray(), binaryp.getStartOffset() + 2, binaryp.getLength() - 2);
// Write string
startString();
sb.appendUtf8Bytes(baaos.getByteArray(), 0, baaos.size());
sendStringDataOutput(dOut);
}