Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twelvemonkey not in front #37

Closed
THausherr opened this issue Feb 12, 2014 · 1 comment
Closed

twelvemonkey not in front #37

THausherr opened this issue Feb 12, 2014 · 1 comment

Comments

@THausherr
Copy link

Documentation:
"The TwelveMonkeys service providers for TIFF and JPEG overrides the onRegistration method, and utilizes the pairwise partial ordering mechanism of the IIOServiceRegistry to make sure it is installed before the Sun/Oracle provided JPEGImageReader and the Apple provided TIFFImageReader on OS X, respectively. "

Code:

Iterator jpegReaders = ImageIO.getImageReadersByFormatName("JPEG");
while (jpegReaders.hasNext()) {
System.out.println("jpeg reader: " + jpegReaders.next());
}
Iterator tiffReaders = ImageIO.getImageReadersByFormatName("TIFF");
while (tiffReaders.hasNext()) {
System.out.println("tiff reader: " + tiffReaders.next());
}

result:
jpeg reader: com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader@5dadd1c5
jpeg reader: com.sun.imageio.plugins.jpeg.JPEGImageReader@4929a06b
tiff reader: com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader@247ab39
tiff reader: com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReader@5f3f333c

So the tiff reader isn't in front :-( Or does the documentation mean that it only applies to OSX?

@haraldk
Copy link
Owner

haraldk commented Feb 13, 2014

Hi,

Unless you are using the Apple-provided TIFFImageReader, there is no explicit pairwise ordering. So your result is not unexpected (the order is simply undefined).

The reason we do the ordering in some special cases, is to make sure you are using our plugins instead of the bundled plugins. For non-bundled plugins, users have made a choice to include these plugins, and also have more control over the registration process, so it makes less sense to do explicit ordering by default (and consider what would happen, if all third-party plugins made sure they were ordered first...).

I assume you are using the TIFFImageReader from JAI ImageIO (jai-imageio.jar). Then you can change the order, either by removing the other plugins from class path, by modifying the class path order (first on class path will be registered first), or by using code similar to the one found in com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderSpi.

Hope that explains it! :-)

(Closing the issue, as not a bug)

Harald K

@haraldk haraldk closed this as completed Feb 13, 2014
@haraldk haraldk added the Bug label Mar 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants