Java Code Examples for javax.imageio.ImageIO#getReaderMIMETypes()

The following examples show how to use javax.imageio.ImageIO#getReaderMIMETypes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GetReaderWriterInfoNullTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main (String[] args) throws IIOException {
    // Verify getReaderMIMETypes() behavior by keeping MIMEType as null.
    TestImageReaderSpi mimeNullReadSpi =
            new TestImageReaderSpi(FORMATNAMES, SUFFIXES, null);
    IIORegistry.getDefaultInstance().
            registerServiceProvider(mimeNullReadSpi);
    ImageIO.getReaderMIMETypes();
    IIORegistry.getDefaultInstance().
            deregisterServiceProvider(mimeNullReadSpi);

    /*
     * Verify getReaderFileSuffixes() behavior by keeping
     * file suffix as null.
     */
    TestImageReaderSpi suffixNullReadSpi =
            new TestImageReaderSpi(FORMATNAMES, null, MIMETYPES);
    IIORegistry.getDefaultInstance().
            registerServiceProvider(suffixNullReadSpi);
    ImageIO.getReaderFileSuffixes();
    IIORegistry.getDefaultInstance().
            deregisterServiceProvider(suffixNullReadSpi);
}
 
Example 2
Source File: ImageDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 3
Source File: ImageDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 4
Source File: ImageDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 5
Source File: ImageDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 6
Source File: ImageDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 7
Source File: ImageDataContentHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 8
Source File: ImageDataContentHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 9
Source File: ImageDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 10
Source File: ImageDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 11
Source File: GetReaderWriterInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testGetReaderMIMETypes() {
    String[] types = ImageIO.getReaderMIMETypes();
    for (String t : types) {
        Iterator<ImageReader> it = ImageIO.getImageReadersByMIMEType(t);
        if (!it.hasNext()) {
            throw new RuntimeException("getReaderMIMETypes returned " +
                                       "an unknown type: " + t);
        }
    }
}
 
Example 12
Source File: IIOPluginTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    SecurityManager sm = System.getSecurityManager();
    System.out.println("Sm is " + sm);

    String formatNames[] = ImageIO.getReaderFormatNames();
    String readerMimeTypes[] = ImageIO.getReaderMIMETypes();

    if (!isPresent(dummyformatNames, formatNames) ||
        !isPresent(dummymimeType, readerMimeTypes)) {
        throw new RuntimeException("No test plugin available!");
    }
}
 
Example 13
Source File: GetReaderWriterInfo.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testGetReaderMIMETypes() {
    String[] types = ImageIO.getReaderMIMETypes();
    for (String t : types) {
        Iterator<ImageReader> it = ImageIO.getImageReadersByMIMEType(t);
        if (!it.hasNext()) {
            throw new RuntimeException("getReaderMIMETypes returned " +
                                       "an unknown type: " + t);
        }
    }
}
 
Example 14
Source File: ImageDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 15
Source File: ImageDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 16
Source File: ImageDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 17
Source File: ImageDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(
            java.awt.Image.class, mimeTypes[i], "Image");
    }
}
 
Example 18
Source File: ImageDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 19
Source File: ImageDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example 20
Source File: ImageLoadJaiTest.java    From java-image-processing-survival-guide with Apache License 2.0 4 votes vote down vote up
/**
 * List available image formats.
 * see http://examples.javacodegeeks.com/desktop-java/imageio/list-read-write-supported-image-formats/
 */
@Test
public void testListSupportedImageFormats() throws Exception {

    Set<String> set = new HashSet<String>();

    // Get list of all informal format names understood by the current set of registered readers
    String[] formatNames = ImageIO.getReaderFormatNames();

    for (int i = 0; i < formatNames.length; i++) {
        set.add(formatNames[i].toLowerCase());
    }
    System.out.println("Supported read formats: " + set);

    set.clear();

    // Get list of all informal format names understood by the current set of registered writers
    formatNames = ImageIO.getWriterFormatNames();

    for (int i = 0; i < formatNames.length; i++) {
        set.add(formatNames[i].toLowerCase());
    }
    System.out.println("Supported write formats: " + set);

    set.clear();

    // Get list of all MIME types understood by the current set of registered readers
    formatNames = ImageIO.getReaderMIMETypes();

    for (int i = 0; i < formatNames.length; i++) {
        set.add(formatNames[i].toLowerCase());
    }
    System.out.println("Supported read MIME types: " + set);

    set.clear();

    // Get list of all MIME types understood by the current set of registered writers
    formatNames = ImageIO.getWriterMIMETypes();

    for (int i = 0; i < formatNames.length; i++) {
        set.add(formatNames[i].toLowerCase());
    }
    System.out.println("Supported write MIME types: " + set);
}