public long getBaseByteCount() throws IOException { if (mSpillover == null) { return mLocalBuffer.getBaseByteCount(); } else { return mSpillover.getBaseByteCount(); } }
protected void finalize() throws IOException { if (mLocalBuffer != null) { long count = mLocalBuffer.getBaseByteCount(); mLocalBuffer = null; mGroup.adjustLevel(-count); } }
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); }