Skip to content
New issue

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

Added methods to guess mime types #2925

Merged
merged 2 commits into from Sep 19, 2019

Conversation

@jsfan3
Copy link
Contributor

commented Sep 18, 2019

Codename One lacks of methods to guess mime types (OpenJDK8 provides them). Sometimes they could be useful: for example, my Android phone returns files from Gallery without extension. Checking if a given file is an Image, for example, is a lot faster and without RAM usage trying to guess the mime type than trying to instantiate an Image object.

Currently supported mime types:

application/java-vm, application/msword, application/pdf, image/photoshop, application/postscript, audio/mp3, application/x-java-serialized-object, text/html, application/xml, image/bmp, image/tiff, image/gif, image/x-bitmap, image/x-pixmap, image/png, image/jpeg, image/jpg, application/acad, audio/basic, audio/x-wav, application/zip

In future we can add other mime types with other Pull Requestes.
Note that my implementation is similar but not equal to the OpenJDK8 implementation: inside the code, I inserted two links for reference.

jsfan3 added 2 commits Sep 18, 2019
Codename One lacks of methods to guess mime types (OpenJDK8 provides them). Sometimes they could be useful: for example, my Android phone returns files from Gallery without extension. Checking if a given file is an Image, for example, is a lot faster and without RAM usage trying to guess the mime type than trying to instantiate an Image object.

Currently supported mime types:

application/java-vm, application/msword, application/pdf, image/photoshop, application/postscript, audio/mp3, application/x-java-serialized-object, text/html, application/xml, image/bmp, image/tiff, image/gif, image/x-bitmap, image/x-pixmap, image/png, image/jpeg, image/jpg, application/acad, audio/basic, audio/x-wav, application/zip

In future we can add other mime types with other Pull Requestes.
Note that my implementation is similar but not equal to the OpenJDK8 implementation: inside the code, I inserted two links for reference.
Fixed a small mistake
@codenameone codenameone merged commit 48c8ec6 into codenameone:master Sep 19, 2019
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/jenkins/pr-merge This commit cannot be built
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@codenameone

This comment has been minimized.

Copy link
Owner

commented Sep 19, 2019

Thanks!

@jsfan3 jsfan3 deleted the jsfan3:patch-1 branch Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.