/**
  * if out == null => automatically create/reuse a bytebuffer
  *
  * @param out
  */
 public void resetForReUse(OutputStream out) {
   if (closed) throw new RuntimeException("Can't reuse closed stream");
   codec.reset();
   if (out != null) {
     codec.setOutstream(out);
   }
   objects.clearForWrite();
 }
 public void resetForReUse(byte[] out) {
   if (closed) throw new RuntimeException("Can't reuse closed stream");
   codec.reset();
   codec.reset(out);
   objects.clearForWrite();
 }
 void resetAndClearRefs() {
   codec.reset();
   objects.clearForWrite();
 }