Package org.apache.thrift.transport
Class AutoExpandingBuffer
- java.lang.Object
-
- org.apache.thrift.transport.AutoExpandingBuffer
-
public class AutoExpandingBuffer extends java.lang.Object
Helper class that wraps a byte[] so that it can expand and be reused. Users should call resizeIfNecessary to make sure the buffer has suitable capacity, and then use the array as needed. Note that the internal array will grow at a rate slightly faster than the requested capacity with the (untested) objective of avoiding expensive buffer allocations and copies.
-
-
Constructor Summary
Constructors Constructor Description AutoExpandingBuffer(int initialCapacity, double growthCoefficient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
array()
void
resizeIfNecessary(int size)
-