public class DataSenderWriter
extends java.io.OutputStreamWriter
JSONStreamAware
objects should call getJsonifiedOptionallyCompressedEncodedString(Object, Writer)
Modifier | Constructor and Description |
---|---|
protected |
DataSenderWriter(java.io.OutputStream out) |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data,
java.io.Writer writer)
Returns a JSON string that will be deflate compressed and base 64 encoded if
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). |
static java.lang.Object |
getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data,
java.io.Writer writer,
int compressionLevel)
Returns a JSON string that will be deflate compressed and base 64 encoded if
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). |
static java.lang.Object |
getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data,
java.io.Writer writer,
int compressionLevel,
int resultSizeLimitInBytes)
Returns a JSON string that will be deflate compressed and base 64 encoded if
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). |
static boolean |
isCompressingWriter(java.io.Writer writer) |
static java.lang.String |
nullValue() |
static java.lang.String |
toJSONString(java.lang.Object obj)
Get a JSON string for the object.
|
protected DataSenderWriter(java.io.OutputStream out) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static final java.lang.String nullValue()
public static final boolean isCompressingWriter(java.io.Writer writer)
public static java.lang.Object getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data, java.io.Writer writer)
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). The JSON string will be returned raw and uncompressed otherwise.data
- the data to be serialized to JSONwriter
- the writer to usepublic static java.lang.Object getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data, java.io.Writer writer, int compressionLevel)
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). The JSON string will be returned raw and uncompressed otherwise.data
- the data to be serialized to JSONwriter
- the writer to usecompressionLevel
- the compression level to use (if the data is compressed)public static java.lang.Object getJsonifiedOptionallyCompressedEncodedString(java.lang.Object data, java.io.Writer writer, int compressionLevel, int resultSizeLimitInBytes)
AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY
is disabled (default). The JSON string will be returned raw and uncompressed otherwise.
Additionally, the payload will be compressed in all cases to compare its size against the passed in limit. If the
result is larger than the limit then a null value will be returned indicating that the JSON is larger than the
limit.
If the compressed result is under the limit then the simple_compression rules from the first paragraph apply and
either the compressed or uncompressed JSON will be returned.data
- the data to be serialized to JSONwriter
- the writer to usecompressionLevel
- the compression level to use (if the data is compressed or to check size limit)resultSizeLimitInBytes
- the maximum size in bytes of the compressed version of the resultpublic static java.lang.String toJSONString(java.lang.Object obj)