public void write(TungstenProperties properties,boolean fsync) throws FileIOException {
  String contents;
  if (JAVA_PROPERTIES.equals(format)) {
    TreeMap<String,String> map=new TreeMap<String,String>(properties.map());
    StringBuffer sb=new StringBuffer();
    for (    String key : map.keySet()) {
      sb.append(String.format("%s=%s\n",key,map.get(key)));
    }
    contents=sb.toString();
  }
 else   if (JSON.equals(format)) {
    try {
      contents=properties.toJSON(true);
    }
 catch (    Exception e) {
      throw new FileIOException("Unable to convert to JSON: file=" + filePath.toString() + " format="+ format,e);
    }
  }
 else {
    throw new FileIOException("Unrecognized property output format: file=" + filePath.toString() + " format="+ format);
  }
  fileIO.write(filePath,contents,charset,fsync);
}

public void write ( TungstenProperties properties , boolean fsync ) throws FileIOException { String contents ; if ( JAVA_PROPERTIES . equals ( format ) ) { TreeMap < String , String > map = new TreeMap < String , String > ( properties . map ( ) ) ; StringBuffer sb = new StringBuffer ( ) ; for ( String key : map . keySet ( ) ) { sb . append ( String . format ( "%s=%s\n" , key , map . get ( key ) ) ) ; } contents = sb . toString ( ) ; } else if ( JSON . equals ( format ) ) { try { contents = properties . toJSON ( true ) ; } catch ( Exception e ) { throw new FileIOException ( "Unable to convert to JSON: file=" + filePath . toString ( ) + " format=" + format , e ) ; } } else { throw new FileIOException ( "Unrecognized property output format: file=" + filePath . toString ( ) + " format=" + format ) ; } fileIO . write ( filePath , contents , charset , fsync ) ; }
write properties file to the file system using selected serialization format and character set .
