Class AbstractStreamBufferPool<B>
java.lang.Object
net.officefloor.server.stream.impl.AbstractStreamBufferPool<B>
- All Implemented Interfaces:
AutoCloseable,StreamBufferPool<B>
- Direct Known Subclasses:
ThreadLocalStreamBufferPool
Abstract
StreamBufferPool.- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFileStreamBuffer(FileChannel file, long position, long count, FileCompleteCallback callback) Obtains aStreamBufferfor theFileChannelcontent.getUnpooledStreamBuffer(ByteBuffer buffer) Obtains anStreamBufferthat is not pooled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.officefloor.server.stream.StreamBufferPool
close, getPooledStreamBuffer
-
Constructor Details
-
AbstractStreamBufferPool
public AbstractStreamBufferPool()
-
-
Method Details
-
getUnpooledStreamBuffer
Description copied from interface:StreamBufferPoolObtains an
StreamBufferthat is not pooled. This is forByteBufferinstances that are managed outside the BufferPool.Typical use is to create
StreamBufferfor some read-only cached content within aByteBuffer.- Specified by:
getUnpooledStreamBufferin interfaceStreamBufferPool<B>- Parameters:
buffer-ByteBuffer.- Returns:
StreamBufferfor the unpooledByteBuffer.
-
getFileStreamBuffer
public StreamBuffer<B> getFileStreamBuffer(FileChannel file, long position, long count, FileCompleteCallback callback) Description copied from interface:StreamBufferPoolObtains a
StreamBufferfor theFileChannelcontent.This enables efficient writing (ie DMA) of
FileChannelcontent.To write the entire
FileChannelcontents, invokewrite(file, 0, -1).Note that the underlying implementation will need to support
FileChannelefficiencies.- Specified by:
getFileStreamBufferin interfaceStreamBufferPool<B>- Parameters:
file-FileChannel.position- Position within theFileChannelto start writing content. Must be non-negative number.count- Count of bytes to write from theFileChannel. A negative value (typically-1) indicates to write the remainingFileChannelcontent from the position.callback- OptionalFileCompleteCallback. May benull.- Returns:
StreamBufferfor theFileChannel.
-