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

10
LINES

< > BotCompany Repo | #1030484 // fileContentsIs

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

Libraryless. Click here for Pure Java version (2776L/16K).

1  
sbool fileContentsIs(File f, byte[] data) ctex {
2  
  if (isFile(f) != (data != null)) false;
3  
  int l = l(data);
4  
  if (fileSize(f) != l) false;
5  
  temp BufferedInputStream in = bufferedFileInputStream(f);
6  
  for ofs to l:
7  
    if (data[ofs] != (byte) in.read())
8  
      false;
9  
  true;
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030484
Snippet name: fileContentsIs
Eternal ID of this version: #1030484/3
Text MD5: cc332e43b650cfe9ba736711ba851ab1
Transpilation MD5: 92c9d649b6860e17bd90da185ae813d4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-25 20:49:26
Source code size: 287 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 341
Version history: 2 change(s)
Referenced in: [show references]