diff --git a/src/com/t_oster/liblasercut/LaserCutter.java b/src/com/t_oster/liblasercut/LaserCutter.java index 6fc765435bc7f6b3bb05f0ed2d82d2db7bbbda4f..64cc8b26a24702d421e4cf85cdd05c1319563703 100644 --- a/src/com/t_oster/liblasercut/LaserCutter.java +++ b/src/com/t_oster/liblasercut/LaserCutter.java @@ -24,6 +24,8 @@ package com.t_oster.liblasercut; import com.t_oster.liblasercut.platform.Point; import com.t_oster.liblasercut.platform.Util; +import sun.reflect.generics.reflectiveObjects.NotImplementedException; + import java.util.LinkedList; import java.util.List; @@ -80,7 +82,10 @@ public abstract class LaserCutter implements Cloneable, Customizable { */ public abstract void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception; - public abstract void saveJob(LaserJob job) throws IllegalJobException, Exception; + public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws NotImplementedException, IllegalJobException, Exception { + System.err.println("Your driver does not implement saveJob(LaserJob job)"); + throw new NotImplementedException(); + } /** * If you lasercutter supports autofocus, override this method, diff --git a/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java b/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java index 3d2db21e6d7db713af6a9ba807e881675fb97c26..cc0f29d02aea419ccf3a059194f8f52aa0d193eb 100644 --- a/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java +++ b/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.UnsupportedEncodingException; +import java.lang.Exception; import java.net.InetSocketAddress; import java.net.Socket; import java.net.URI; @@ -661,14 +662,12 @@ public class GenericGcodeDriver extends LaserCutter { } @Override -public void saveJob(LaserJob job) throws IllegalJobException, Exception { +public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws IllegalJobException, Exception { checkJob(job); - String timestamp = new SimpleDateFormat( "yyyyMMddhhmmssSSS" ).format( new Date( ) ); - String filename = "output_" + timestamp + ".gcode"; - System.out.println("Creating file " + filename); - this.out = new PrintStream(new File(filename)); + this.out = fileOutputStream; + boolean wasSetWaitingForOk = isWaitForOKafterEachLine(); setWaitForOKafterEachLine( false ); writeInitializationCode(); @@ -695,7 +694,7 @@ public void saveJob(LaserJob job) throws IllegalJobException, Exception { writeShutdownCode(); this.out.flush(); - setWaitForOKafterEachLine(true); + setWaitForOKafterEachLine(wasSetWaitingForOk); } private List<Double> resolutions;