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

The following are Jave code examples for showing how to use getReaderMIMETypes() of the javax.imageio.ImageIO class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: GetReaderWriterInfoNullTest.java   View Source Code Vote up 6 votes
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
Project: OpenJSharp   File: ImageDataContentHandler.java   View Source Code Vote up 5 votes
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 3
Project: OpenJSharp   File: ImageDataContentHandler.java   View Source Code Vote up 5 votes
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
Project: openjdk-jdk10   File: IIOPluginTest.java   View Source Code Vote up 5 votes
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 5
Project: openjdk-jdk10   File: GetReaderWriterInfo.java   View Source Code Vote up 5 votes
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 6
Project: openjdk-jdk10   File: ImageDataContentHandler.java   View Source Code Vote up 5 votes
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
Project: openjdk-jdk10   File: ImageDataContentHandler.java   View Source Code Vote up 5 votes
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
Project: openaudible   File: StandardImageHandler.java   View Source Code Vote up 5 votes
/**
 * Show read formats
 * <p>
 * On Windows supports png/jpeg/bmp/gif
 */
public void showReadFormats() {
    String[] formats = ImageIO.getReaderMIMETypes();
    for (String f : formats) {
        System.out.println("r" + f);
    }
}