private static void bulkOut(ObjectOutput out, Sequence<Item> entity, boolean remotePaing)
throws IOException {
final FastByteArrayOutputStream bufOut = new FastByteArrayOutputStream(16384);
final ObjectOutputStream objOut = new ObjectOutputStream(bufOut);
final XQEventEncoder encoder = new XQEventEncoder(objOut);
if(remotePaing) {
encoder.setRemotePaging(true);
}
try {
encoder.emit(entity);
} catch (XQueryException xqe) {
throw new IllegalStateException("failed encoding", xqe);
} catch (Throwable e) {
LOG.fatal(e);
throw new IllegalStateException("failed encoding", e);