Interface StructuredJsonGenerator
- All Known Implementing Classes:
SdkCborGenerator,SdkJsonGenerator,SdkRpcV2CborGenerator
Interface for generating a JSON
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StructuredJsonGeneratorNo-op implementation that ignores all calls and returns empty bytes from getBytes. -
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the size of the generated content in bytes without copying.default ContentStreamProviderReturns aContentStreamProviderthat streams the generated content.byte[]getBytes()Deprecated.default StructuredJsonGeneratorwriteBinaryValue(byte[] bytes) Writes binary data directly from a byte array, avoiding the overhead of wrapping in aByteBuffer.writeFieldName(String fieldName) writeNumber(String number) default StructuredJsonGeneratorwriteStartArray(int size) writeValue(boolean bool) default StructuredJsonGeneratorwriteValue(byte val) writeValue(double val) writeValue(float val) writeValue(int val) writeValue(long val) writeValue(short val) writeValue(String val) writeValue(BigDecimal value) writeValue(BigInteger value) writeValue(ByteBuffer bytes) writeValue(Instant instant)
-
Field Details
-
NO_OP
No-op implementation that ignores all calls and returns empty bytes from getBytes.
-
-
Method Details
-
writeStartArray
StructuredJsonGenerator writeStartArray() -
writeStartArray
-
writeEndArray
StructuredJsonGenerator writeEndArray() -
writeNull
StructuredJsonGenerator writeNull() -
writeStartObject
StructuredJsonGenerator writeStartObject() -
writeEndObject
StructuredJsonGenerator writeEndObject() -
writeFieldName
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeValue
-
writeBinaryValue
Writes binary data directly from a byte array, avoiding the overhead of wrapping in aByteBuffer. The default implementation wraps the array and delegates towriteValue(ByteBuffer). -
writeValue
-
writeNumber
-
writeValue
-
writeValue
-
getBytes
byte[] getBytes() -
getContentType
Deprecated.New clients use.invalid reference
SdkJsonProtocolFactory#getContentType() -
contentSize
default int contentSize()Returns the size of the generated content in bytes without copying. The default implementation falls back togetBytes().length. -
contentStreamProvider
Returns aContentStreamProviderthat streams the generated content. The default implementation wraps the result ofgetBytes()in aByteArrayInputStream. Implementations may override this to stream directly from internal buffers without copying.- Returns:
- a content stream provider, or
nullifgetBytes()returns null
-