com.sun.pdfview
Class PDFParser

java.lang.Object
  extended by com.sun.pdfview.BaseWatchable
      extended by com.sun.pdfview.PDFParser
All Implemented Interfaces:
Watchable, java.lang.Runnable

public class PDFParser
extends BaseWatchable

PDFParser is the class that parses a PDF content stream and produces PDFCmds for a PDFPage. You should never ever see it run: it gets created by a PDFPage only if needed, and may even run in its own thread.


Field Summary
static int debuglevel
           
 
Fields inherited from interface com.sun.pdfview.Watchable
COMPLETED, ERROR, NEEDS_DATA, NOT_STARTED, PAUSED, RUNNING, STOPPED, UNKNOWN
 
Constructor Summary
PDFParser(PDFPage cmds, byte[] stream, java.util.HashMap resources)
          Don't call this constructor directly.
 
Method Summary
 void cleanup()
          Cleanup when iteration is done
static void debug(java.lang.String msg, int level)
           
 java.lang.String dumpStream()
           
 void dumpStreamToError()
           
static java.lang.String escape(java.lang.String msg)
           
 int iterate()
          parse the stream.
static void setDebugLevel(int level)
           
 void setup()
          Called to prepare for some iterations
 
Methods inherited from class com.sun.pdfview.BaseWatchable
execute, getStatus, go, go, go, go, isExecutable, isFinished, run, setError, setStatus, stop, waitForFinish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debuglevel

public static int debuglevel
Constructor Detail

PDFParser

public PDFParser(PDFPage cmds,
                 byte[] stream,
                 java.util.HashMap resources)
Don't call this constructor directly. Instead, use PDFFile.getPage(int pagenum) to get a PDFPage. There should never be any reason for a user to create, access, or hold on to a PDFParser.

Method Detail

debug

public static void debug(java.lang.String msg,
                         int level)

escape

public static java.lang.String escape(java.lang.String msg)

setDebugLevel

public static void setDebugLevel(int level)

setup

public void setup()
Called to prepare for some iterations

Overrides:
setup in class BaseWatchable

iterate

public int iterate()
            throws java.lang.Exception
parse the stream. commands are added to the PDFPage initialized in the constructor as they are encountered.

Page numbers in comments refer to the Adobe PDF specification.

Specified by:
iterate in class BaseWatchable
Returns:
  • Watchable.RUNNING when there are commands to be processed
  • Watchable.COMPLETED when the page is done and all the commands have been processed
  • Watchable.STOPPED if the page we are rendering into is no longer available
Throws:
java.lang.Exception

cleanup

public void cleanup()
Cleanup when iteration is done

Overrides:
cleanup in class BaseWatchable

dumpStreamToError

public void dumpStreamToError()

dumpStream

public java.lang.String dumpStream()