get Mime Type Of InputStream - Android android.webkit

Android examples for android.webkit:MimeTypeMap

Description

get Mime Type Of InputStream

Demo Code

import java.io.InputStream;

import android.graphics.BitmapFactory;

public class Main {

  public static String getMimeTypeOfInputStream(InputStream stream) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;/*from   w  w w  .  ja  v  a  2 s  . co m*/
    BitmapFactory.decodeStream(stream, null, options);
    return options.outMimeType;
  }

}

Related Tutorials