public class FileSignatureChecker
extends java.lang.Object
| Constructor and Description |
|---|
FileSignatureChecker() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkForRIFF(byte[] data)
Check if a given byte array has a signature that starts with 'RIFF'
|
static boolean |
checkForWebP(byte[] image)
Check if a given byte array has the necessary WebP signature in the beginning of its content.
|
static boolean |
containsAt(byte[] haystack,
byte[] needle,
int offset)
Check if a byte array contains another byte array that is equal or smaller in size
|
static boolean |
startsWith(byte[] haystack,
byte[] needle)
Check if a byte array starts with the same bytes as another byte array
that is however smaller than the first one.
|
public static boolean checkForWebP(byte[] image)
image - the byte array to checkpublic static boolean checkForRIFF(byte[] data)
data - the byte array to checkpublic static boolean startsWith(byte[] haystack,
byte[] needle)
haystack - e.g. {-1, -40, -1, -32, ........}needle - e.g. {-1, -40, -1, -32}haystack starts with the same bytes as needlepublic static boolean containsAt(byte[] haystack,
byte[] needle,
int offset)
haystack - e.g. {..., -1, -40, -1, -32, ...}needle - e.g. {-1, -40, -1, -32}offset - the index where needle should be starting in haystackneedle is contained in haystack starting at index offset