Class RecordStreamBody
java.lang.Object
org.apache.juneau.rest.client.classic.RecordStreamBody
Wrapper that lets a caller pass a
Consumer<RecordWriter> or
Consumer<TokenWriter> as the body of a @RemoteOp request.
The framework resolves the matching serializer for the request's Content-Type,
opens a writer of the appropriate kind, and hands it to the caller's consumer. When the
consumer returns, the writer is closed and the request body is dispatched.
Usage:
-
Method Summary
Modifier and TypeMethodDescriptionConsumer<?>Class<?>static RecordStreamBodyrecords(Consumer<RecordWriter> consumer) Creates a body that streams via aRecordWriter(whole-value record cursor).static RecordStreamBodytoken(Consumer<TokenWriter> consumer) Creates a body that streams via aTokenWriter(fine-grained structural cursor).
-
Method Details
-
records
Creates a body that streams via aRecordWriter(whole-value record cursor).- Parameters:
consumer- The callback that emits records. Must not benull .- Returns:
- A new body wrapper.
-
token
Creates a body that streams via aTokenWriter(fine-grained structural cursor).- Parameters:
consumer- The callback that emits structural events. Must not benull .- Returns:
- A new body wrapper.
-
getConsumer
- Returns:
- The caller's consumer (typed as Consumer<RecordWriter> or Consumer<TokenWriter>).
-
getWriterKind
- Returns:
- Either
RecordWriter.classorTokenWriter.class.
-