Introduced the capability of inserting buffers at a specific index.

This commit is contained in:
Simone Bordet 2014-08-04 12:12:19 +02:00
parent a2faa030cc
commit 1c984e680f
1 changed files with 12 additions and 2 deletions

View File

@ -75,8 +75,7 @@ public interface ByteBufferPool
public void prepend(ByteBuffer buffer, boolean recycle)
{
buffers.add(0, buffer);
recycles.add(0, recycle);
insert(0, buffer, recycle);
}
public void append(ByteBuffer buffer, boolean recycle)
@ -85,6 +84,12 @@ public interface ByteBufferPool
recycles.add(recycle);
}
public void insert(int index, ByteBuffer buffer, boolean recycle)
{
buffers.add(index, buffer);
recycles.add(index, recycle);
}
public List<ByteBuffer> getByteBuffers()
{
return buffers;
@ -98,6 +103,11 @@ public interface ByteBufferPool
return length;
}
public int getSize()
{
return buffers.size();
}
public void recycle()
{
for (int i = 0; i < buffers.size(); ++i)