//
// Setup Base64Encoder stream to byte array.
//
ByteArrayOutputStream os = new ByteArrayOutputStream();
Base64EncoderStream b64Encoder = new Base64EncoderStream(os);
try {
//
// Now, encode the input image to the base 64 stream.
//
encodeImage(image, b64Encoder);
// Close the b64 encoder stream (terminates the b64 streams).
b64Encoder.close();
} catch (IOException e) {
// Should not happen because we are doing in-memory processing
throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e);
}