- /**
- * @方法功能说明:比较比较文件内容是否一致,根据字节比较
- * @参数:@param f1
- * @参数:@param f2
- * @参数:@return
- * @参数:@throws IOException
- * @return:boolean
- */
- public boolean compareFileContentByChar(File f1 ,File f2) throws IOException{
- FileInputStream fis1 = new FileInputStream(f1);
- FileInputStream fis2 = new FileInputStream(f2);
- int b = 0;
- int c = 0;
- while(true){
- b = fis1.read();
- c = fis2.read();
- if(b!=-1 && c!=-1){
- if(b!=c){
- return false;
- }
- }else{
- break;
- }
- }
- return true;
- }
- //该片段来自于http://www.codesnippet.cn/detail/291120137629.html
来源: http://www.codesnippet.cn/detail/291120137629.html