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