We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I get a byte array from a url, then test it with magic class. And it has thrown a MagicMatchNotFoundException.
Code:
public static String getMimeType(byte[] bytes) throws MagicParseException, MagicMatchNotFoundException, MagicException { Magic parser = new Magic(); MagicMatch match = parser.getMagicMatch(bytes); return match.getMimeType(); }
Test code:
String bmpUrl = "https://raw.githubusercontent.com/arimus/jmimemagic/master/test_docs/test.bmp";
byte[] bmpFIle = IOUtils.toByteArray((new URL(bmpUrl)).openStream()); assertThat(FileHelper.getMimeType(bmpFIle)).isEqualTo("image/bmp");
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I get a byte array from a url, then test it with magic class. And it has thrown a MagicMatchNotFoundException.
Code:
public static String getMimeType(byte[] bytes) throws MagicParseException, MagicMatchNotFoundException, MagicException {
Magic parser = new Magic();
MagicMatch match = parser.getMagicMatch(bytes);
return match.getMimeType();
}
Test code:
String bmpUrl = "https://raw.githubusercontent.com/arimus/jmimemagic/master/test_docs/test.bmp";
byte[] bmpFIle = IOUtils.toByteArray((new URL(bmpUrl)).openStream());
assertThat(FileHelper.getMimeType(bmpFIle)).isEqualTo("image/bmp");
The text was updated successfully, but these errors were encountered: