code: private void writeMetadataFile(Path directoryPath,
                                     FileSystem outputFs,
                                     String metadataFileName,
                                     ReadOnlyStorageMetadata metadata) throws IOException {
          Path metadataPath = new Path(directoryPath, metadataFileName);
          FSDataOutputStream metadataStream = outputFs.create(metadataPath);
          outputFs.setPermission(metadataPath, new FsPermission(HADOOP_FILE_PERMISSION));
          metadataStream.write(metadata.toJsonString().getBytes());
          metadataStream.flush();
          metadataStream.close();
      }
docs: Persists a *.metadata file to a specific directory in HDFS.
  
  @param directoryPath where to write the metadata file.
  @param outputFs {@link org.apache.hadoop.fs.FileSystem} where to write the file
  @param metadataFileName name of the file (including extension)
  @param metadata {@link voldemort.store.readonly.ReadOnlyStorageMetadata} to persist on HDFS
  @throws IOException if the FileSystem operations fail