public void writeTo(final OutputStream outstream) throws IOException {
if (outstream instanceof MetricAware) {
// hchar: There is currently no implementation of output stream that
// has metric gathering capability but there could be!
// So the code here is for future proof purposes.
MetricAware aware = (MetricAware)outstream;
if (aware.isMetricActivated()) {
// let the underlying output stream takes care of byte counting
super.writeTo(outstream);
return;
}
}