Package org.apache.parquet.bytes
Class ByteBufferReleaser
- java.lang.Object
-
- org.apache.parquet.bytes.ByteBufferReleaser
-
- All Implemented Interfaces:
AutoCloseable
public class ByteBufferReleaser extends Object implements AutoCloseable
Convenient class for releasingByteBufferobjects with the corresponding allocator;
-
-
Constructor Summary
Constructors Constructor Description ByteBufferReleaser(ByteBufferAllocator allocator)Constructs a newByteBufferReleaserinstance with the specifiedByteBufferAllocatorto be used for releasing the buffers inclose().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidreleaseLater(ByteBuffer buffer)Adds aByteBufferobject to the list of buffers to be released atclose().
-
-
-
Constructor Detail
-
ByteBufferReleaser
public ByteBufferReleaser(ByteBufferAllocator allocator)
Constructs a newByteBufferReleaserinstance with the specifiedByteBufferAllocatorto be used for releasing the buffers inclose().- Parameters:
allocator- the allocator to be used for releasing the buffers- See Also:
releaseLater(ByteBuffer),close()
-
-
Method Detail
-
releaseLater
public void releaseLater(ByteBuffer buffer)
Adds aByteBufferobject to the list of buffers to be released atclose(). The specified buffer shall be one that was allocated by theByteBufferAllocatorof this object.- Parameters:
buffer- the buffer to be released
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-