code: private void writeFile()
              throws IOException
      {
          LOGGER.debug( "Writing credentials file to {}", file );
          File tempFile = new File( file.getPath() + ".tmp" );
  
          Writer writer = null;
          try {
              writer = new OutputStreamWriter( new FileOutputStream( tempFile ), PcsUtils.UTF8 );
  
              for ( String key : credentialsMap.keySet() ) {
                  Credentials cred = credentialsMap.get( key );
                  final String line = key + "=" + cred.toJson() + "\n";
                  writer.write( line );
              }
              writer.flush();
  
          } finally {
              PcsUtils.closeQuietly( writer );
          }
  
          file.delete();
          tempFile.renameTo( file );
      }
docs: Serializes credentials data
  
  @throws IOException Error while saving the file