Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for guessContentTypeFromStream (0.09 sec)

  1. src/main/java/org/codelibs/core/net/MimeTypeUtil.java

            assertArgumentNotEmpty("path", path);
    
            final InputStream is = ResourceUtil.getResourceAsStream(path);
            try {
                final String mimetype = URLConnection.guessContentTypeFromStream(is);
                if (mimetype != null) {
                    return mimetype;
                }
                return URLConnection.guessContentTypeFromName(path);
            } catch (final IOException e) {
    Registered: Fri Nov 01 20:58:10 UTC 2024
    - Last Modified: Thu Mar 07 01:59:08 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  2. src/test/java/org/codelibs/core/net/MimeTypeUtilTest.java

         */
        @Test
        public void testGetFromPath() throws Exception {
            final String path = ClassUtil.getPackageName(this.getClass()).replaceAll("\\.", "/") + "/bbb.html";
            final String s = URLConnection.guessContentTypeFromStream(ResourceUtil.getResourceAsStream(path));
            assertNull(s);
            final String contentType = MimeTypeUtil.guessContentType(path);
            assertEquals("text/html", contentType);
        }
    
        /**
    Registered: Fri Nov 01 20:58:10 UTC 2024
    - Last Modified: Thu Mar 07 01:59:08 UTC 2024
    - 2.7K bytes
    - Viewed (0)
Back to top