protected static void writeReferencePositions(String filePath, ArrayList<Position> positions) throws FileNotFoundException { PrintStream os = new PrintStream(new File(filePath)); for (Position pos : positions) { os.format( "%.5f %.5f %.4f\n", pos.getLatitude().degrees, pos.getLongitude().degrees, pos.getElevation()); } os.flush(); }
public static void main(final String[] args) { File logdir = new File(LOG_DIR); if (!logdir.exists()) logdir.mkdirs(); File log = new File(logdir, "client.log"); // redirect all console output to the file try { PrintStream out = new PrintStream(new FileOutputStream(log, true), true); out.format("[%s] ===== Client started =====%n", timestampf.format(new Date())); System.setOut(out); System.setErr(out); } catch (FileNotFoundException e) { e.printStackTrace(); } /* Set up the error handler as early as humanly possible. */ ThreadGroup g = new ThreadGroup("Haven main group"); String ed; if (!(ed = Utils.getprop("haven.errorurl", "")).equals("")) { try { final haven.error.ErrorHandler hg = new haven.error.ErrorHandler(new java.net.URL(ed)); hg.sethandler( new haven.error.ErrorGui(null) { public void errorsent() { hg.interrupt(); } }); g = hg; } catch (java.net.MalformedURLException e) { } } Thread main = new HackThread( g, new Runnable() { public void run() { main2(args); } }, "Haven main thread"); main.start(); }