比较两个文件是否一样
File inputFile = new File("C:\\0001.DAT");File outputFile = new File("C:\\0002.DAT");FileInputStream in;FileInputStream out;try {in = new FileInputStream(inputFile);out = new FileInputStream(outputFile);int i;int j = 0;while ((i = in.read()) != -1) {j++;byte inByte = (byte) i;byte outByte = (byte) out.read();if (inByte != outByte) {System.out.println("in===="+j);}}}catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}
页:
[1]