Class ChunkPagingProvider
java.lang.Object
com.mulesoftforge.mule.extension.chunking.internal.paging.ChunkPagingProvider
- All Implemented Interfaces:
org.mule.runtime.extension.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>,org.mule.sdk.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>
public class ChunkPagingProvider
extends Object
implements org.mule.runtime.extension.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>
PagingProvider that lazily produces Chunk objects from an InputStream.
Memory usage: O(chunkSize) + O(1) for probe byte
- Single buffer for reading chunks
- 1-byte pushback buffer for EOF detection
- NO read-ahead buffer that would double memory
isLast detection strategy:
1. Read chunk into buffer
2. If partial read (invalid input: '<' chunkSize), this is last chunk
3. If full read, probe with 1-byte read:
- If returns -1: this is last chunk
- If returns byte: push back, more data exists
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(ChunkingConnection connection) getPage(ChunkingConnection connection) getTotalResults(ChunkingConnection connection) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mule.sdk.api.runtime.streaming.PagingProvider
useStickyConnections
-
Constructor Details
-
ChunkPagingProvider
-
-
Method Details
-
getPage
- Specified by:
getPagein interfaceorg.mule.sdk.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>
-
getTotalResults
- Specified by:
getTotalResultsin interfaceorg.mule.sdk.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>
-
close
public void close(ChunkingConnection connection) throws org.mule.runtime.api.exception.MuleException - Specified by:
closein interfaceorg.mule.sdk.api.runtime.streaming.PagingProvider<ChunkingConnection, Chunk>- Throws:
org.mule.runtime.api.exception.MuleException
-