Class AbstractStreamBufferPool<B>
- java.lang.Object
-
- net.officefloor.server.stream.impl.AbstractStreamBufferPool<B>
-
- All Implemented Interfaces:
StreamBufferPool<B>
- Direct Known Subclasses:
ThreadLocalStreamBufferPool
public abstract class AbstractStreamBufferPool<B> extends java.lang.Object implements StreamBufferPool<B>
AbstractStreamBufferPool.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractStreamBufferPool.FileStreamBufferFileChannelStreamBuffer.protected classAbstractStreamBufferPool.UnpooledStreamBufferUnpooledStreamBuffer.
-
Constructor Summary
Constructors Constructor Description AbstractStreamBufferPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamBuffer<B>getFileStreamBuffer(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback)Obtains aStreamBufferfor theFileChannelcontent.StreamBuffer<B>getUnpooledStreamBuffer(java.nio.ByteBuffer buffer)Obtains anStreamBufferthat is not pooled.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.server.stream.StreamBufferPool
getPooledStreamBuffer
-
-
-
-
Method Detail
-
getUnpooledStreamBuffer
public StreamBuffer<B> getUnpooledStreamBuffer(java.nio.ByteBuffer buffer)
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(java.nio.channels.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.
-
-