if(encodedSequence != null) {
final FastByteArrayOutputStream bufOut = new FastByteArrayOutputStream(16384);
final ObjectOutputStream objOut = new ObjectOutputStream(bufOut);
final XQEventEncoder encoder = new XQEventEncoder(objOut);
try {
encoder.emit(actualSequence);
objOut.flush();
} catch (XQueryException xqe) {
throw new IOException(PrintUtils.prettyPrintStackTrace(xqe));
} catch (Throwable e) {
LOG.fatal(e);