private bool Closing = false; // To avoid recursive closing /// <summary> /// Closes the stream. This is done by flushing the stream and then closing /// the underlying output stream. /// </summary> /// <seealso cref= java.io.OutputStream#close() </seealso> public override void Close() { lock (this) { if (!Closing) { Closing = true; try { TextOut.Close(); @out.Close(); } catch (IOException) { Trouble = true; } TextOut = null; CharOut = null; @out = null; } } }
//needs to figure out why .16g thing isnt working in runtime..it is java after all and working inthe original. public void saveConfigMinMax_java() { if (save_filename != null) { java.util.Formatter formatter = new java.util.Formatter(new java.lang.StringBuilder()); java.io.BufferedWriter fp_save = null; try { fp_save = new java.io.BufferedWriter(new java.io.FileWriter(save_filename)); } catch (java.io.IOException e) { System.Console.Error.WriteLine("can't open file " + save_filename); //Environment.Exit(1); } if (y_scaling) { formatter.format("y\n"); formatter.format("%.16g %.16g\n", y_lower, y_upper); formatter.format("%.16g %.16g\n", y_min, y_max); } formatter.format("x\n"); formatter.format("%.16g %.16g\n", lower, upper); for (int i = 1; i <= max_index; i++) { if (feature_min[i] != feature_max[i]) { formatter.format("%d %.16g %.16g\n", i, feature_min[i], feature_max[i]); } } fp_save.write(formatter.toString()); fp_save.close(); } }
private PrintStream(bool autoFlush, OutputStream @out, Charset charset) : base(@out) { this.AutoFlush = autoFlush; this.CharOut = new OutputStreamWriter(this, charset); this.TextOut = new BufferedWriter(CharOut); }