use of nl.nn.adapterframework.stream.json.JsonTee in project iaf by ibissource.
the class MessageOutputStream method captureBinaryStream.
@SuppressWarnings("resource")
public void captureBinaryStream(OutputStream outputStream, int maxSize) {
log.debug("creating capture of " + ClassUtils.nameOf(requestStream));
closeOnClose(outputStream);
if (requestStream instanceof OutputStream) {
requestStream = StreamUtil.captureOutputStream((OutputStream) requestStream, outputStream, maxSize);
return;
}
if (requestStream instanceof ContentHandler) {
requestStream = new XmlTee((ContentHandler) requestStream, new PrettyPrintFilter(new XmlWriter(StreamUtil.limitSize(outputStream, maxSize))));
return;
}
if (requestStream instanceof JsonEventHandler) {
requestStream = new JsonTee((JsonEventHandler) requestStream, new JsonWriter(StreamUtil.limitSize(outputStream, maxSize)));
return;
}
if (requestStream instanceof Writer) {
requestStream = StreamUtil.captureWriter((Writer) requestStream, new OutputStreamWriter(outputStream, StreamUtil.DEFAULT_CHARSET), maxSize);
return;
}
log.warn("captureBinaryStream() called before stream is installed.");
}
use of nl.nn.adapterframework.stream.json.JsonTee in project iaf by ibissource.
the class MessageOutputStream method captureCharacterStream.
@SuppressWarnings("resource")
public void captureCharacterStream(Writer writer, int maxSize) {
log.debug("creating capture of " + ClassUtils.nameOf(requestStream));
closeOnClose(writer);
if (requestStream instanceof Writer) {
requestStream = StreamUtil.captureWriter((Writer) requestStream, writer, maxSize);
return;
}
if (requestStream instanceof ContentHandler) {
requestStream = new XmlTee((ContentHandler) requestStream, new PrettyPrintFilter(new XmlWriter(StreamUtil.limitSize(writer, maxSize))));
return;
}
if (requestStream instanceof JsonEventHandler) {
requestStream = new JsonTee((JsonEventHandler) requestStream, new JsonWriter(StreamUtil.limitSize(writer, maxSize)));
return;
}
if (requestStream instanceof OutputStream) {
requestStream = StreamUtil.captureOutputStream((OutputStream) requestStream, new WriterOutputStream(writer, StreamUtil.DEFAULT_CHARSET), maxSize);
return;
}
log.warn("captureCharacterStream() called before stream is installed.");
}
Aggregations