Final Plug-in Code

As discussed previously, ImageReaders and ImageWriters may be made known to the JVM through the use of plug-ins. The remainder of the chapter will be devoted to presenting the code listings for the ch5ImageReader and ch5ImageWriter classes, along with their corresponding service provider interfaces and metadata classes.

ch5ImageReader

Listing 5.6 is identical to Listing 5.5, except that the metadata formats have now been defined so the getMetadata and getImageData methods no longer return null.

The way metadata is used in this ImageReader class is that the setInput and read methods obtain the stream and image metadata respectively (see Table 5.2). This metadata is then available to be returned to an application that uses the ...

Get Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.