Class SipsJP2Reader


  • final class SipsJP2Reader
    extends java.lang.Object
    QuickFix for OS X (where ICNS are most useful) and JPEG 2000. Dumps the stream to disk and converts using sips command line tool: sips -s format png <temp>. Reads image back using ImageIO and known format (png).
    Version:
    $Id: JPEG2000Reader.java,v 1.0 25.11.11 14:17 haraldk Exp$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean DEBUG  
      private javax.imageio.stream.ImageInputStream input  
      private static java.io.File SIPS_COMMAND  
      private static boolean SIPS_EXISTS_AND_EXECUTES  
    • Constructor Summary

      Constructors 
      Constructor Description
      SipsJP2Reader()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String[] buildCommand​(java.io.File sipsCommand, java.io.File tempFile)  
      private static java.lang.String checkErrorMessage​(java.lang.Process process)  
      private static boolean convertToPNG​(java.io.File tempFile)  
      private static java.io.File dumpToFile​(javax.imageio.stream.ImageInputStream stream)  
      private static boolean existsAndExecutes​(java.io.File cmd)  
      (package private) static boolean isAvailable()  
      java.awt.image.BufferedImage read​(int imageIndex, javax.imageio.ImageReadParam param)  
      void setInput​(javax.imageio.stream.ImageInputStream input)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SIPS_COMMAND

        private static final java.io.File SIPS_COMMAND
      • SIPS_EXISTS_AND_EXECUTES

        private static final boolean SIPS_EXISTS_AND_EXECUTES
      • DEBUG

        private static final boolean DEBUG
      • input

        private javax.imageio.stream.ImageInputStream input
    • Constructor Detail

      • SipsJP2Reader

        SipsJP2Reader()
    • Method Detail

      • existsAndExecutes

        private static boolean existsAndExecutes​(java.io.File cmd)
      • read

        public java.awt.image.BufferedImage read​(int imageIndex,
                                                 javax.imageio.ImageReadParam param)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • setInput

        public void setInput​(javax.imageio.stream.ImageInputStream input)
      • convertToPNG

        private static boolean convertToPNG​(java.io.File tempFile)
                                     throws javax.imageio.IIOException
        Throws:
        javax.imageio.IIOException
      • checkErrorMessage

        private static java.lang.String checkErrorMessage​(java.lang.Process process)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • buildCommand

        private static java.lang.String[] buildCommand​(java.io.File sipsCommand,
                                                       java.io.File tempFile)
      • dumpToFile

        private static java.io.File dumpToFile​(javax.imageio.stream.ImageInputStream stream)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • isAvailable

        static boolean isAvailable()