Package java.net

Examples of java.net.FileNameMap


    final String resource = u.getPath();
    return new URLConnection(u) {
      public void connect() {
      }
            public String getContentType() {
                FileNameMap fileNameMap = java.net.URLConnection.getFileNameMap();
                String contentType = fileNameMap.getContentTypeFor(resource);
                if (contentType == null)
                    contentType = "text/plain";
                return contentType;
            }
      public InputStream getInputStream() throws IOException {
View Full Code Here


    final String resource = u.getPath();
    return new URLConnection(u) {
      public void connect() {
      }
            public String getContentType() {
                FileNameMap fileNameMap = java.net.URLConnection.getFileNameMap();
                String contentType = fileNameMap.getContentTypeFor(resource);
                if (contentType == null)
                    contentType = "text/plain";
                return contentType;
            }
      public InputStream getInputStream() throws IOException {
View Full Code Here

     */
    public static String MIMETypeForFileName (String fileName,         // NOPMD
                                              String defaultMIMEType)
    {
        String mimeType = null;
        FileNameMap fileNameMap = URLConnection.getFileNameMap();

        // Check ours first.

        loadMappings();

        String extension = FileUtil.getFileNameExtension (fileName);
        mimeType = (String) extensionToMIMETypeMap.get (extension);

        if (mimeType == null)
        {
            // Check the system one.

            mimeType = fileNameMap.getContentTypeFor (fileName);
        }

        if (mimeType != null)
        {
            if (mimeType.equals (DEFAULT_MIME_TYPE) &&
View Full Code Here

TOP

Related Classes of java.net.FileNameMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.