Using a ByteBufOutputstream is better (I think) as ByteArrayOutputStream uses synchronized etc and we not need it.