Clearing the buffer before returning it.

This commit is contained in:
Simone Bordet 2014-06-10 12:00:20 +02:00
parent e0474108d0
commit 1d2e9da29c
1 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,8 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.util.BufferUtil;
/**
* <p>A {@link ByteBuffer} pool.</p>
* <p>Acquired buffers may be {@link #release(ByteBuffer) released} but they do not need to;
@ -67,6 +69,7 @@ public interface ByteBufferPool
public ByteBuffer acquire(int capacity, boolean direct)
{
ByteBuffer buffer = byteBufferPool.acquire(capacity, direct);
BufferUtil.clearToFill(buffer);
append(buffer, true);
return buffer;
}