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

13
LINES

< > BotCompany Repo | #1004676 // isPNG

JavaX fragment (include)

1  
static byte[] PNG_MAGIC = bytesFromHex("89504E470D0A1A0A");
2  
3  
static bool isPNG(byte[] data) {
4  
  if (data.length < PNG_MAGIC.length) return false;
5  
  for (int i = 0; i < PNG_MAGIC.length; i++)
6  
    if (data[i] != PNG_MAGIC[i])
7  
      false;
8  
  true;
9  
}
10  
11  
static bool isPNG(File f) {
12  
  ret isPNG(loadFirstBytes(f, l(PNG_MAGIC));
13  
}

Author comment

Began life as a copy of #1003863

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004676
Snippet name: isPNG
Eternal ID of this version: #1004676/2
Text MD5: c7cc3816fc78c4e05595ea18705bf86b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-25 13:51:11
Source code size: 334 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 539 / 593
Version history: 1 change(s)
Referenced in: [show references]