SequenceFileTool { public static void main(String[] args) throws Exception { final SequenceFileTool options = new SequenceFileTool(); final CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (final CmdLineException e) { System.err.println(e.getMessage()); System.err.println("Usage: java -jar SequenceFileTool.jar [options...]"); parser.printUsage(System.err); if (options.mode == null) { for (final Mode m : Mode.values()) { System.err.println(); System.err.println(m + " options: "); new CmdLineParser(m.getOptions()).printUsage(System.err); } } return; } options.execute(); }  void execute(); static void main(String[] args);  }
@Test public void testSequenceFileExtraction() throws Exception { final File out = folder.newFile("random-10"); out.delete(); final String[] args = new String[] { "-m", "EXTRACT", tmpImageSEQ.getAbsolutePath(), "-o", out.getAbsolutePath(), "-n", "KEY" }; SequenceFileTool.main(args); for (final File f : out.listFiles()) { FileInputStream fis = null; try { fis = new FileInputStream(f); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final byte[] buffer = new byte[1024]; int len = 0; while ((len = fis.read(buffer)) != -1) { bos.write(buffer, 0, len); } bos.flush(); assertTrue(Arrays.equals(imageByteArray.get(f.getName()), bos.toByteArray())); } finally { fis.close(); } } }
@Test public void testRelativeSequenceFileExtraction() throws Exception { final File out = folder.newFile("random.10"); out.delete(); final String[] args = new String[] { "-m", "LIST", tmpImageSEQRelative.getAbsolutePath(), "-opts", "KEY" }; SequenceFileTool.main(args); }