Interface PayloadSerializer
-
- All Known Implementing Classes:
DslJsonSerializer
public interface PayloadSerializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPayloadSerializer.UninitializedException
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappendMetaDataNdJsonToStream()Appends the serialized metadata to ND-JSON as ametadataline.voidappendMetadataToStream()Appends the serialized metadata to the underlyingOutputStream.voidblockUntilReady()Blocking until thisPayloadSerializeris ready for use.voidflushToOutputStream()Flushes content that has been written so far to theOutputStreamwhich has been set viasetOutputStream(OutputStream), without flushing theOutputStreamitself.voidfullFlush()Flushes theOutputStreamwhich has been set viasetOutputStream(OutputStream)and detaches thatOutputStreamfrom the serializer.intgetBufferSize()Gets the number of bytes which are currently bufferedcom.dslplatform.json.JsonWritergetJsonWriter()voidserializeErrorNdJson(ErrorCapture error)voidserializeFileMetaData(java.io.File file)voidserializeSpanNdJson(Span span)voidserializeTransactionNdJson(Transaction transaction)voidsetOutputStream(java.io.OutputStream os)Sets the output stream which the*NdJsonmethods should write to.voidwriteBytes(byte[] bytes, int len)
-
-
-
Method Detail
-
setOutputStream
void setOutputStream(java.io.OutputStream os)
Sets the output stream which the*NdJsonmethods should write to.- Parameters:
os- theOutputStreamto which all contents are to be serialized
-
blockUntilReady
void blockUntilReady() throws java.lang.ExceptionBlocking until thisPayloadSerializeris ready for use.- Throws:
java.lang.Exception- if blocking was interrupted, or timed out or an error occurred in the underlying implementation
-
appendMetaDataNdJsonToStream
void appendMetaDataNdJsonToStream() throws PayloadSerializer.UninitializedExceptionAppends the serialized metadata to ND-JSON as ametadataline.NOTE: Must be called after
blockUntilReady()was called and returned, otherwise the cached serialized metadata may not be ready yet.- Throws:
PayloadSerializer.UninitializedException- may be thrown ifblockUntilReady()was not invoked
-
appendMetadataToStream
void appendMetadataToStream() throws PayloadSerializer.UninitializedExceptionAppends the serialized metadata to the underlyingOutputStream.NOTE: Must be called after
blockUntilReady()was called and returned, otherwise the cached serialized metadata may not be ready yet.- Throws:
PayloadSerializer.UninitializedException- may be thrown ifblockUntilReady()was not invoked
-
serializeTransactionNdJson
void serializeTransactionNdJson(Transaction transaction)
-
serializeSpanNdJson
void serializeSpanNdJson(Span span)
-
serializeErrorNdJson
void serializeErrorNdJson(ErrorCapture error)
-
fullFlush
void fullFlush() throws java.io.IOExceptionFlushes theOutputStreamwhich has been set viasetOutputStream(OutputStream)and detaches thatOutputStreamfrom the serializer.- Throws:
java.io.IOException
-
flushToOutputStream
void flushToOutputStream()
Flushes content that has been written so far to theOutputStreamwhich has been set viasetOutputStream(OutputStream), without flushing theOutputStreamitself. Subsequent serializations will be made to the sameOutputStream.
-
getBufferSize
int getBufferSize()
Gets the number of bytes which are currently buffered- Returns:
- the number of bytes which are currently buffered
-
serializeFileMetaData
void serializeFileMetaData(java.io.File file)
-
getJsonWriter
com.dslplatform.json.JsonWriter getJsonWriter()
-
writeBytes
void writeBytes(byte[] bytes, int len)
-
-