Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1025332 // filesHaveSameContents

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2192L/14K).

sbool filesHaveSameContents(File a, File b) ctex {
  long n = fileSize(a);
  if (fileSize(b) != n) false;
  
  temp InputStream is1 = newBufferedInputStream(a);
  temp InputStream is2 = newBufferedInputStream(b);
  
  int data;
  while ping ((data = is1.read()) != -1)
    if (data != is2.read()) false;

  true;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025332
Snippet name: filesHaveSameContents
Eternal ID of this version: #1025332/2
Text MD5: 2a4c17b9c1f7c67bda40cc58149a5854
Transpilation MD5: 3fffc7ffa41b70e5d6d686132013ba1f
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-23 13:34:07
Source code size: 326 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 109 / 166
Version history: 1 change(s)
Referenced in: [show references]