public void writeTo(OutputStream out) throws IOException { if (mSpillover == null) { mLocalBuffer.writeTo(out); } else { mSpillover.writeTo(out); } }
private void spillover() throws IOException { mSpillover = mGroup.createFileByteBuffer(); // TODO: This is bad! By writing out the contents of the existing // buffer early, surrogates are evaluated too soon! mLocalBuffer.writeTo(new ByteBufferOutputStream(mSpillover)); long count = mLocalBuffer.getBaseByteCount(); mLocalBuffer = null; mGroup.adjustLevel(-count); }