use of org.apache.commons.io.output.CountingOutputStream in project wso2-axis2-transports by wso2.
the class WSMimeMessage method writeTo.
@Override
public void writeTo(OutputStream out, String[] ignoreHeaders) throws MessagingException, IOException {
if (bytesSent == -1) {
CountingOutputStream countingOut = new CountingOutputStream(out);
super.writeTo(countingOut, ignoreHeaders);
bytesSent = countingOut.getByteCount();
} else {
super.writeTo(out, ignoreHeaders);
}
}
use of org.apache.commons.io.output.CountingOutputStream in project jmeter by apache.
the class SmtpSampler method calculateMessageSize.
private long calculateMessageSize(Message message) throws IOException, MessagingException {
if (getPropertyAsBoolean(MESSAGE_SIZE_STATS)) {
// calculate message size
CountingOutputStream cs = new CountingOutputStream(new NullOutputStream());
message.writeTo(cs);
return cs.getByteCount();
} else {
return -1L;
}
}
Aggregations