eu.scape_project.pc.cc
Class JpylyzerWrapper

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by eu.scape_project.pc.cc.JpylyzerWrapper
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class JpylyzerWrapper
extends org.xml.sax.helpers.DefaultHandler

Version:
0.1 Created Jan 16, 2012:4:19:36 PM
Author:
Carl Wilson carlwilson-bl AT SourceForge carlwilson-bl AT github

Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(String uri, String localName, String qName)
           
 int getBitsPerComponent()
           
 String getColourSpaceName()
           
 double getCompressionRatio()
           
 String getCompressionType()
           
 String[] getElementsAsStringArray()
          Get the properties as a String array for quick writing to CSV file.
 double getHorizontalResolution()
           
 int getHorizontalSize()
          Get the horizontal (x) size of the image
static JpylyzerWrapper getInstance()
           
static JpylyzerWrapper getInstance(String pathToJpylyzer)
           
 String getJpylyzerVersion()
           
static String getJpylyzerVersion(String path)
          Routine to check that the Jpylyzer executable exists at a path location and obtain the version (a date stamp)
 int getNumberOfImageComponents()
           
 double getVerticalResolution()
           
 int getVerticalSize()
          Get the vertical (y) size of the image
 boolean isValid()
          Is the image a valid JP2K?
static void main(String[] args)
          This is a simple test, note that Jpylyzer MUST be at DEFAULT_JPYLYZER_PATH for this main to work, it doesn't take a path to the exe as an arg.
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 String toString()
           
 boolean validateJp2kFile(File jp2kFile)
           
 boolean validateJp2kFile(String path)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

validateJp2kFile

public boolean validateJp2kFile(String path)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Parameters:
path - the path to a file to run the Jpylyzer is to be run.
Returns:
true if the file found at the path location is a valid JPEG 2K
Throws:
ParserConfigurationException
SAXException
IOException

validateJp2kFile

public boolean validateJp2kFile(File jp2kFile)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Parameters:
jp2kFile -
Returns:
true if the JP2K is valid, false otherwise
Throws:
SAXException
ParserConfigurationException
IOException

getHorizontalSize

public int getHorizontalSize()
Get the horizontal (x) size of the image

Returns:
the horizontal size of the image in pixels

getVerticalSize

public int getVerticalSize()
Get the vertical (y) size of the image

Returns:
the vertical size of the image in pixels

getHorizontalResolution

public double getHorizontalResolution()
Returns:
the horizontal capture resolution in dots per inch

getVerticalResolution

public double getVerticalResolution()
Returns:
the vertical capture resolution in dots per inch

isValid

public boolean isValid()
Is the image a valid JP2K?

Returns:
true if a valid JP2K, false otherwise.

getNumberOfImageComponents

public int getNumberOfImageComponents()
Returns:
the number of image components for the JP2K

getBitsPerComponent

public int getBitsPerComponent()
Returns:
the number of bits per component for the JP2K

getCompressionType

public String getCompressionType()
Returns:
the detected compression type for the JP2K

getColourSpaceName

public String getColourSpaceName()
Returns:
the name of the colour space for the JP2K

getCompressionRatio

public double getCompressionRatio()
Returns:
the compression ratio for the JP2K

getJpylyzerVersion

public String getJpylyzerVersion()
Returns:
the version string for Jpylyzer, this is a date ATM

toString

public String toString()
Overrides:
toString in class Object

getElementsAsStringArray

public String[] getElementsAsStringArray()
Get the properties as a String array for quick writing to CSV file.

Returns:
the measured properties of the JP2k as an array of Strings

getInstance

public static JpylyzerWrapper getInstance()
Returns:
a new instance of the Jpylyzer wrapper using the "default" binary location

getInstance

public static JpylyzerWrapper getInstance(String pathToJpylyzer)
Parameters:
pathToJpylyzer - a string path to the jpylyzer executable
Returns:
a new instance of the JpylyzerWrapper running the executable at the path passed.

getJpylyzerVersion

public static String getJpylyzerVersion(String path)
                                 throws IllegalStateException
Routine to check that the Jpylyzer executable exists at a path location and obtain the version (a date stamp)

Parameters:
path - the string path to the Jpylyzer executable.
Returns:
the version date stamp for the executable
Throws:
IllegalStateException - if the Jpylyzer executable cannot be found.

main

public static void main(String[] args)
This is a simple test, note that Jpylyzer MUST be at DEFAULT_JPYLYZER_PATH for this main to work, it doesn't take a path to the exe as an arg.

Parameters:
args - a list of paths to JP2Ks to validate
Throws:
SAXException
ParserConfigurationException
FileNotFoundException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler


Copyright © 2013. All Rights Reserved.