public synchronized byte[] getBuf(int len) {
        for (int i = 0; i < mBuffersBySize.size(); i++) {
            byte[] buf = mBuffersBySize.get(i);
            if (buf.length >= len) {
                mCurrentSize -= buf.length;
                mBuffersBySize.remove(i);
                mBuffersByLastUse.remove(buf);
                return buf;
            }
        }
        return new byte[len];
    }
public synchronized byte [ ] getBuf ( int len ) { for ( int i = 0 ; i < mBuffersBySize . size ( ) ; i ++ ) { byte [ ] buf = mBuffersBySize . get ( i ) ; if ( buf . length >= len ) { mCurrentSize -= buf . length ; mBuffersBySize . remove ( i ) ; mBuffersByLastUse . remove ( buf ) ; return buf ; } } return new byte [ len ] ; }
Returns a buffer from the pool if one is available in the requested size, or allocates a new
one if a pooled one is not available.

@param len the minimum size, in bytes, of the requested buffer. The returned buffer may be
larger.
@return a byte[] buffer is always returned.