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

13
LINES

< > BotCompany Repo | #1004676 // isPNG

JavaX fragment (include)

static byte[] PNG_MAGIC = bytesFromHex("89504E470D0A1A0A");

static bool isPNG(byte[] data) {
  if (data.length < PNG_MAGIC.length) return false;
  for (int i = 0; i < PNG_MAGIC.length; i++)
    if (data[i] != PNG_MAGIC[i])
      false;
  true;
}

static bool isPNG(File f) {
  ret isPNG(loadFirstBytes(f, l(PNG_MAGIC));
}

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: 484 / 529
Version history: 1 change(s)
Referenced in: [show references]