Created
August 30, 2018 11:24
-
-
Save naimdjon/8ba36060b5c30184e91a2423fed3c065 to your computer and use it in GitHub Desktop.
Java snippet to check pdf signature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isPdf(byte[] content) { | |
final byte[] pdfSignature = { (byte) 0x25, (byte) 0x50, (byte) 0x44, (byte) 0x46 }; | |
return Arrays.equals(copyOfRange(content, 0, 4), pdfSignature); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment