Class CopyingStreamWindow
- java.lang.Object
-
- com.couchbase.client.core.json.stream.CopyingStreamWindow
-
- All Implemented Interfaces:
StreamWindow,Closeable,AutoCloseable
public class CopyingStreamWindow extends Object implements StreamWindow
A stream window implementation that copies input data into a single accumulator buffer.
-
-
Constructor Summary
Constructors Constructor Description CopyingStreamWindow(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator allocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buf)Appends the given buffer to the end of the stream.voidclose()Releases all buffers owned by the window.byte[]getBytes(long startStreamOffset, long endStreamOffset)Returns a region of the stream as a byte array.voidreleaseBefore(long releaseStreamOffset)Forgets any bytes with stream offsets lower then the given offset.StringtoString()
-
-
-
Method Detail
-
add
public void add(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf buf)
Description copied from interface:StreamWindowAppends the given buffer to the end of the stream. The window takes ownership of the buffer (and may even release it immediately).- Specified by:
addin interfaceStreamWindow
-
releaseBefore
public void releaseBefore(long releaseStreamOffset)
Description copied from interface:StreamWindowForgets any bytes with stream offsets lower then the given offset.- Specified by:
releaseBeforein interfaceStreamWindow- Parameters:
releaseStreamOffset- offset relative to the start of the stream.
-
getBytes
public byte[] getBytes(long startStreamOffset, long endStreamOffset)Description copied from interface:StreamWindowReturns a region of the stream as a byte array.- Specified by:
getBytesin interfaceStreamWindow- Parameters:
startStreamOffset- region start offset relative to beginning of stream.endStreamOffset- region end offset relative to beginning of stream.
-
close
public void close()
Description copied from interface:StreamWindowReleases all buffers owned by the window.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceStreamWindow
-
-