jdk/src/java.desktop/share/classes/sun/awt/www/content/MultimediaContentHandlers.java
author prappo
Fri, 10 Jul 2015 16:40:12 +0100
changeset 31642 7ae76e376fcd
permissions -rw-r--r--
8064925: URLConnection::getContent needs to be updated to work with modules Reviewed-by: chegar, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31642
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     1
/*
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     4
 *
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    10
 *
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    15
 * accompanied this code).
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    16
 *
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    20
 *
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    23
 * questions.
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    24
 */
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    25
package sun.awt.www.content;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    26
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    27
import sun.awt.www.content.audio.wav;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    28
import sun.awt.www.content.audio.x_aiff;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    29
import sun.awt.www.content.image.gif;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    30
import sun.awt.www.content.audio.aiff;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    31
import sun.awt.www.content.audio.basic;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    32
import sun.awt.www.content.audio.x_wav;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    33
import sun.awt.www.content.image.jpeg;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    34
import sun.awt.www.content.image.png;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    35
import sun.awt.www.content.image.x_xbitmap;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    36
import sun.awt.www.content.image.x_xpixmap;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    37
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    38
import java.net.ContentHandler;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    39
import java.net.ContentHandlerFactory;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    40
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    41
public final class MultimediaContentHandlers implements ContentHandlerFactory {
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    42
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    43
    @Override
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    44
    public ContentHandler createContentHandler(String mimetype) {
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    45
        switch (mimetype) {
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    46
            case "audio/aiff":      return new aiff();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    47
            case "audio/basic":     return new basic();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    48
            case "audio/wav":       return new wav();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    49
            case "audio/x-aiff":    return new x_aiff();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    50
            case "audio/x-wav":     return new x_wav();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    51
            case "image/gif":       return new gif();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    52
            case "image/jpeg":      return new jpeg();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    53
            case "image/png":       return new png();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    54
            case "image/x-xbitmap": return new x_xbitmap();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    55
            case "image/x-xpixmap": return new x_xpixmap();
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    56
            default:                return null;
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    57
        }
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    58
    }
7ae76e376fcd 8064925: URLConnection::getContent needs to be updated to work with modules
prappo
parents:
diff changeset
    59
}