@Test public void test_main_online() throws IOException { URL online = new URL("http://luckydonald.github.io/OfflineData.bin"); if (GraphicsEnvironment.isHeadless()) { this.binFileReader = new BinFileReader(online); } else { this.binFileReader = new BinFileReaderGui(online); } do_read_from_bin(); }
@Test public void test_main_offline() throws IOException { File offline = new File("OfflineData.bin"); if (offline.exists() && !offline.isDirectory()) { this.getLogger().info("OfflineData.bin file exists."); if (GraphicsEnvironment.isHeadless()) { this.binFileReader = new BinFileReader(offline); } else { this.binFileReader = new BinFileReaderGui(offline); } do_read_from_bin(); System.out.println(""); } else { getLogger().warning("No OfflineData.bin file!"); } }
public void do_read_from_bin() throws IOException { Database db = new Database(); DBEntry foo = binFileReader.readNextEntry(db); ArrayList<BinFileReadLogger> loggerz = binFileReader.getLoggerz(); long endPos = -1; this.getLogger(); for (BinFileReadLogger log : loggerz) { endPos = log.getEndPosition(); // System.out.println(log); } if (!GraphicsEnvironment.isHeadless()) { ((BinFileReaderGui) binFileReader).updateHex(); } System.out.println(foo.toSimpleString()); if (endPos < 499796) { // Le fail. this.getLogger() .warning("Didn't read the complete file. Read " + endPos + " of 499796 bytes."); } }