code: synchronized long dumpState(OutputStream snapshotOutputStream) throws IOException {
          try {
              ObjectMapper mapper = new ObjectMapper();
              // by default Jackson 'takes ownership' of a closeable passed
              // to it and _closes_ it after writing a value. this is probably
              // OK if we're writing a set of JSON nodes contained in a
              // single root object. however, since we're writing a set of
              // objects without a root object we have to disable this
              // behavior so that all values are written to the underlying stream
              mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
              for (Map.Entry<String, String> entry : entries.entrySet()) {
                  mapper.writeValue(snapshotOutputStream, new KeyValue(entry.getKey(), entry.getValue()));
              }
  
              return lastAppliedIndex;
          } finally {
              Closeables.close(snapshotOutputStream, true);
          }
      }
docs: Store all {@code key=>value} pairs to the
  given {@code snapshotOutputStream}. This implementation
  stores all pairs as a sequence of JSON {@link KeyValue}
  instances and closes the stream after all pairs are written.
  <strong>No</strong> internal state is modified by this operation.
  
  @param snapshotOutputStream {@code OutputStream} to which all {@code key=>value} pairs are written
  @return log index >= 0 of the
  @throws IOException if the {@code key=>value} pairs cannot
  be written to {@code snapshotOutputStream}. Since no internal state is
  modified {@code LocalStore} can still be used safely after an exception is thrown
  @throws RuntimeException if the {@code key=>value} pairs in {@code LocalStore} cannot be converted to JSON