private static void setStream(String in, String out) { try { System.setIn(new BufferedInputStream(new FileInputStream(in))); System.setOut(new PrintStream(out)); } catch (Exception e) { e.printStackTrace(); } }
public void diff(int id, String small, String large) { try { Scanner sm = new Scanner(new File(small)); Scanner lg = new Scanner(new File(large)); int line = 0; while (sm.hasNextLine() && lg.hasNextLine()) { String s = sm.nextLine(); String l = lg.nextLine(); if (!s.equals(l)) { System.out.println(line + ">" + s); System.out.println(line + "<" + l); } line++; } } catch (Exception e) { e.printStackTrace(); } }