code: void saveFSImage(String dest, DataOutputStream fstream) throws IOException {
      saveNamespaceContext.set(namesystem, editLog.getLastWrittenTxId());
      FSImageFormat.Saver saver = new FSImageFormat.Saver(saveNamespaceContext);
      FSImageCompression compression = FSImageCompression.createCompression(
          namesystem.getConf(), false);
      saver
          .save(new FileOutputStream(new File(dest)), compression, fstream, dest);
    }
docs: for snapshot