org.jimageanalyst.analyzer
Class AnalyzePnm

java.lang.Object
  extended by org.jimageanalyst.AbstractImageAnalyzer
      extended by org.jimageanalyst.analyzer.AnalyzePnm
All Implemented Interfaces:
ImageAnalyzer

public class AnalyzePnm
extends AbstractImageAnalyzer

Analyzer for PNM (PBM, PGM, PPM) images.

Version:
$LastChangedRevision: 2 $
Author:
Oliver J. Siegmar

Constructor Summary
AnalyzePnm()
          Initialize this analyzer.
 
Method Summary
 boolean detectHeader(byte[] data)
          Detect the image type.
 ImageInfo getInfo(Configuration configuration, java.io.InputStream inputStream)
          Extracts the meta information for the given image.
 java.lang.String readLine(java.io.InputStream is)
          Reads a line (everything until a line-feed) from the given InputStream.
 java.lang.String readLine(java.io.InputStream is, java.lang.Appendable appendable)
          Reads a line (everything until a line-feed) from the given InputStream and write it to the specified appendable.
 
Methods inherited from class org.jimageanalyst.AbstractImageAnalyzer
getFormatNames, getHeaderBufSize, getMimeType, getStreamStartPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalyzePnm

public AnalyzePnm()
Initialize this analyzer.

Method Detail

detectHeader

public boolean detectHeader(byte[] data)
Detect the image type.

Parameters:
data - the image header data
Returns:
true if this analyzer is responsible for the given image header

getInfo

public ImageInfo getInfo(Configuration configuration,
                         java.io.InputStream inputStream)
                  throws java.io.IOException,
                         InvalidDataException
Extracts the meta information for the given image.

Parameters:
configuration - the configuration to be used
inputStream - the data source object
Returns:
the meta information for the given image.
Throws:
java.io.IOException - if an IO error occurs while reading data from the data source
InvalidDataException - if the image contains invalid data

readLine

public java.lang.String readLine(java.io.InputStream is)
                          throws java.io.IOException
Reads a line (everything until a line-feed) from the given InputStream.

Parameters:
is - the InputStream to read from
Returns:
a string build from all the characters before the first line-feed
Throws:
java.io.IOException - if an I/O error occurs

readLine

public java.lang.String readLine(java.io.InputStream is,
                                 java.lang.Appendable appendable)
                          throws java.io.IOException
Reads a line (everything until a line-feed) from the given InputStream and write it to the specified appendable.

Parameters:
is - the InputStream to read from
appendable - the appendable to append read data
Returns:
a string build from all the characters before the first line-feed
Throws:
java.io.IOException - if an I/O error occurs


Copyright © 2006-2007. All Rights Reserved.