Java Pastebin - Nopaste - Paste - easy sharing of text and codes

Posted by Anonymous on Fri 3rd Sep 20:01 (modification of post by view diff)
download | new post

  1.         public static void writeParametersBinary(Configuration conf, String name, Map<Integer, double[]> params, Path outputDir) throws IOException
  2.         {
  3.                 FileSystem fs = FileSystem.get(conf);
  4.                 Path file = new Path(outputDir, name);
  5.                 if (fs.exists(file))
  6.                 {
  7.                         fs.delete(file, true);
  8.                 }
  9.                 FSDataOutputStream writer = fs.create(file);
  10.                 writer.writeLong(params.size());
  11.                 for (Map.Entry<Integer, double[]> entry : params.entrySet())
  12.                 {
  13.                         writer.writeInt(entry.getKey());
  14.                         for (double factor : entry.getValue())
  15.                         {
  16.                                 writer.writeDouble(factor);
  17.                         }
  18.                 }
  19.                 writer.sync();
  20.                 writer.flush();
  21.                 writer.close();
  22.         }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


I'm Human
Remember me



Captcha required for posting