de.unikiel.ipn.htmlform
Class PDFParser

java.lang.Object
  |
  +--de.unikiel.ipn.htmlform.PDFParser
All Implemented Interfaces:
MessageHandler, java.lang.Runnable

class PDFParser
extends java.lang.Object
implements java.lang.Runnable, MessageHandler

Used to extract text from a pdf. The extraction method is run(). It should be launched in a seperate thread.


Constructor Summary
(package private) PDFParser(java.io.File file, MessageHandler handler)
          Create a new PDFParser.
 
Method Summary
 void handleMessage(Message msg)
          Handles the Message or forwards it to the successor.
 void run()
          Extracts the text from the pdf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFParser

PDFParser(java.io.File file,
          MessageHandler handler)
Create a new PDFParser.

Parameters:
file - pdf-file to parse from
handler - The run-method will pass Messages to this handler.
Throws:
java.lang.NullPointerException - if file == null or handler == null
See Also:
run()
Method Detail

run

public void run()
Extracts the text from the pdf. When anything goes wrong the method will pass a Message.ERROR_MESSAGE to the successing MessageHandler specified in the constructor. Finally it will always pass a Message.RESULT_MESSAGE to the successing MessageHandler specified in the constructor. That Message will contain the content of the parsed pdf or an empty string if anything went wrong.

Specified by:
run in interface java.lang.Runnable
See Also:
Message

handleMessage

public void handleMessage(Message msg)
Description copied from interface: MessageHandler
Handles the Message or forwards it to the successor. If it handles it by itself may depend for example on the type of the Message or on wether it knows which java.awt.Window is currently focused.

Specified by:
handleMessage in interface MessageHandler
Parameters:
msg - the Message that has to be handled.