Codota Logo
MimeUtils
Code IndexAdd Codota to your IDE (free)

How to use
MimeUtils
in
libcore.net

Best Java code snippets using libcore.net.MimeUtils (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: robovm/robovm

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: robovm/robovm

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: ibinti/bugvm

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: ibinti/bugvm

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: MobiVM/robovm

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: com.bugvm/bugvm-rt

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: com.gluonhq/robovm-rt

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: FlexoVM/flexovm

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: FlexoVM/flexovm

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: MobiVM/robovm

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: com.mobidevelop.robovm/robovm-rt

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
origin: com.bugvm/bugvm-rt

/**
 * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your
 * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins
 * come from "$JAVA_HOME/lib/content-types.properties".
 */
private static void applyOverrides() {
  // Get the appropriate InputStream to read overrides from, if any.
  InputStream stream = getContentTypesPropertiesStream();
  if (stream == null) {
    return;
  }
  try {
    try {
      // Read the properties file...
      Properties overrides = new Properties();
      overrides.load(stream);
      // And translate its mapping to ours...
      for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
        String extension = (String) entry.getKey();
        String mimeType = (String) entry.getValue();
        add(mimeType, extension);
      }
    } finally {
      stream.close();
    }
  } catch (IOException ignored) {
  }
}
origin: com.gluonhq/robovm-rt

  public String getContentTypeFor(String filename) {
    if (filename.endsWith("/")) {
      // a directory, return html
      return MimeUtils.guessMimeTypeFromExtension("html");
    }
    int lastCharInExtension = filename.lastIndexOf('#');
    if (lastCharInExtension < 0) {
      lastCharInExtension = filename.length();
    }
    int firstCharInExtension = filename.lastIndexOf('.') + 1;
    String ext = "";
    if (firstCharInExtension > filename.lastIndexOf('/')) {
      ext = filename.substring(firstCharInExtension, lastCharInExtension);
    }
    return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
  }
}
libcore.netMimeUtils

Javadoc

Utilities for dealing with MIME types. Used to implement java.net.URLConnection and android.webkit.MimeTypeMap.

Most used methods

  • add
  • getContentTypesPropertiesStream
  • guessMimeTypeFromExtension
    Returns the MIME type for the given extension.

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • startActivity (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now