public void backup(OutputStream os) throws IOException {
    int count = 0;
    GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(os);
    for (Master master : mRegistry.getServers()) {
      Iterator<JournalEntry> it = master.getJournalEntryIterator();
      while (it.hasNext()) {
        it.next().toBuilder().clearSequenceNumber().build().writeDelimitedTo(zipStream);
        count++;
      }
    }
    // finish() instead of close() since close would close os, which is owned by the caller.
    zipStream.finish();
    LOG.info("Created backup with {} entries", count);
  }
public void backup ( OutputStream os ) throws IOException { int count = 0 ; GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream ( os ) ; for ( Master master : mRegistry . getServers ( ) ) { Iterator < JournalEntry > it = master . getJournalEntryIterator ( ) ; while ( it . hasNext ( ) ) { it . next ( ) . toBuilder ( ) . clearSequenceNumber ( ) . build ( ) . writeDelimitedTo ( zipStream ) ; count ++ ; } } zipStream . finish ( ) ; LOG . info ( "Created backup with {} entries" , count ) ; }
Writes a backup to the specified stream.

@param os the stream to write to