use of com.willwinder.universalgcodesender.types.GcodeCommand in project Universal-G-Code-Sender by winder.
the class GcodeParserUtils method processAndExportGcodeStream.
/**
* Attempts to read the input file in GcodeStream format.
* @return whether or not we succeed processing the file.
*/
private static boolean processAndExportGcodeStream(GcodeParser gcp, BufferedReader input, File output) throws IOException, GcodeParserException {
// Preprocess a GcodeStream file.
try {
GcodeStreamReader gsr = new GcodeStreamReader(input);
try (GcodeStreamWriter gsw = new GcodeStreamWriter(output)) {
int i = 0;
while (gsr.getNumRowsRemaining() > 0) {
i++;
GcodeCommand gc = gsr.getNextCommand();
write(gcp, gsw, gc.getOriginalCommandString(), gc.getCommandString(), gc.getComment(), i);
}
// Done processing GcodeStream file.
return true;
}
} catch (GcodeStreamReader.NotGcodeStreamFile ex) {
// File exists, but isn't a stream reader. So go ahead and try parsing it as a raw gcode file.
}
return false;
}
Aggregations