Showing posts with label mime table. Show all posts
Showing posts with label mime table. Show all posts

Friday, July 28, 2017

Reading File MIME Type

  What I'm about to share with you covers basic MIME type reading. In some cases, you don't want to use additional external libraries for your project. For this simple task, using readily available classes on Java is always a joy.

  Take extra care because not all commonly known MIME types are supported. I will show you that on the last part. Let's start.

The code:


Some Test:


What else you need to know?

The list of supported MIME types are located on your JRE. Locate the file named content-types.properties at <JRE>/lib directory.  This file is being read by sun.net.www.MimeTable class which happens to be an implementation of java.net.FileNameMap. And, the default instance returned by URLConnection.getFileNameMap() function.

Starting with Basic File Cryptography (XOR Cipher)

  In this blog post, I'll discuss one interesting basic cipher technique to garble a file: The "XOR Cipher". What it does is o...