Java Code Examples for org.apache.commons.codec.binary.Base64OutputStream#write()

The following examples show how to use org.apache.commons.codec.binary.Base64OutputStream#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CastToBase64BinaryOperation.java    From vxquery with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 2
Source File: CastToStringOperation.java    From vxquery with Apache License 2.0 5 votes vote down vote up
@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);
}