code: public MessageBufferOutput reset(MessageBufferOutput out)
              throws IOException
      {
          // Validate the argument
          MessageBufferOutput newOut = checkNotNull(out, "MessageBufferOutput is null");
  
          // Flush before reset
          flush();
          MessageBufferOutput old = this.out;
          this.out = newOut;
  
          // Reset totalFlushBytes
          this.totalFlushBytes = 0;
  
          return old;
      }
docs: Replaces underlying output.
  <p>
  This method flushes current internal buffer to the output, swaps it with the new given output, then returns
  the old output.
  
  <p>
  This method doesn't close the old output.
  
  @param out new output
  @return the old output
  @throws IOException when underlying output throws IOException
  @throws NullPointerException the given output is null