@Test public void testUsage() throws IOException { try { Converter.main(new String[0]); fail("Expected SecurityException"); } catch (final SecurityException e) { } try { Converter.main(new String[] {}); fail("Expected SecurityException"); } catch (final SecurityException e) { } }
public static void main(final String[] args) throws IOException { if (args.length != 1 && args.length != 2) trapPrintUsage(); final String converted = convert(new File(args[0]).getAbsoluteFile().toURI().toURL()); if (args.length == 1) { System.out.println(converted); } else { final File destFile = new File(args[1]); destFile.getParentFile().mkdirs(); Files.write(destFile.toPath(), converted.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } }
Converter { public static void main(final String[] args) throws IOException { if (args.length != 1 && args.length != 2) trapPrintUsage(); final String converted = convert(new File(args[0]).getAbsoluteFile().toURI().toURL()); if (args.length == 1) { System.out.println(converted); } else { final File destFile = new File(args[1]); destFile.getParentFile().mkdirs(); Files.write(destFile.toPath(), converted.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } } }
Converter { public static void main(final String[] args) throws IOException { if (args.length != 1 && args.length != 2) trapPrintUsage(); final String converted = convert(new File(args[0]).getAbsoluteFile().toURI().toURL()); if (args.length == 1) { System.out.println(converted); } else { final File destFile = new File(args[1]); destFile.getParentFile().mkdirs(); Files.write(destFile.toPath(), converted.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } } private  Converter(); }
Converter { public static void main(final String[] args) throws IOException { if (args.length != 1 && args.length != 2) trapPrintUsage(); final String converted = convert(new File(args[0]).getAbsoluteFile().toURI().toURL()); if (args.length == 1) { System.out.println(converted); } else { final File destFile = new File(args[1]); destFile.getParentFile().mkdirs(); Files.write(destFile.toPath(), converted.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } } private  Converter(); static void main(final String[] args); static String jsdToJsdx(final URL url); static String jsdxToJsd(final URL url); static String convert(final URL url); }
Converter { public static void main(final String[] args) throws IOException { if (args.length != 1 && args.length != 2) trapPrintUsage(); final String converted = convert(new File(args[0]).getAbsoluteFile().toURI().toURL()); if (args.length == 1) { System.out.println(converted); } else { final File destFile = new File(args[1]); destFile.getParentFile().mkdirs(); Files.write(destFile.toPath(), converted.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } } private  Converter(); static void main(final String[] args); static String jsdToJsdx(final URL url); static String jsdxToJsd(final URL url); static String convert(final URL url);  }