out.write(spoolBuffer, 0, read);
len += read;
} else if (len + read > BinaryQValue.MAX_BUFFER_SIZE) {
// threshold for keeping data in memory exceeded;
// create temp file and spool buffer contents
TransientFileFactory fileFactory = TransientFileFactory.getInstance();
spoolFile = fileFactory.createTransientFile("bin", null, null);
out = new FileOutputStream(spoolFile);
out.write(buffer, 0, len);
out.write(spoolBuffer, 0, read);
buffer = null;
len += read;