17.05.2014 Views

PDFlib Text Extraction Toolkit (TET) Manual

PDFlib Text Extraction Toolkit (TET) Manual

PDFlib Text Extraction Toolkit (TET) Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The following method of the String class converts a Unicode string to a string according<br />

to the encoding specified in the enc parameter:<br />

byte[] getBytes(String enc)<br />

Javadoc documentation for <strong>TET</strong>. The <strong>TET</strong> package contains Javadoc documentation for<br />

<strong>TET</strong>. The Javadoc contains only abbreviated descriptions of all <strong>TET</strong> API methods; please<br />

refer to Section 10, »<strong>TET</strong> Library API Reference«, page 141, for more details.<br />

In order to configure Javadoc for <strong>TET</strong> in Eclipse proceed as follows:<br />

> In the Package Explorer right-click on the Java project and select Javadoc Location.<br />

> Click on Browse... and select the path where the Javadoc (which is part of the <strong>TET</strong><br />

package) is located.<br />

After these steps you can browse the Javadoc for <strong>TET</strong>, e.g. with the Java Browsing perspective<br />

or via the Help menu.<br />

Exception handling. The <strong>TET</strong> language binding for Java will throw native Java exceptions<br />

of the class <strong>TET</strong>Exception. <strong>TET</strong> client code must use standard Java exception syntax:<br />

<strong>TET</strong> tet = null;<br />

try {<br />

...<strong>TET</strong> method invocations...<br />

} catch (<strong>TET</strong>Exception e) {<br />

System.err.print("<strong>TET</strong> exception occurred:\n");<br />

System.err.print("[" + e.get_errnum() + "] " + e.get_apiname() + ": " +<br />

e.get_errmsg() + "\n");<br />

} catch (Exception e) {<br />

System.err.println(e.getMessage());<br />

} finally {<br />

if (tet != null) {<br />

tet.delete(); /* delete the <strong>TET</strong> object */<br />

}<br />

}<br />

Since <strong>TET</strong> declares appropriate throws clauses, client code must either catch all possible<br />

exceptions or declare those itself.<br />

30 Chapter 3: <strong>TET</strong> Library Language Bindings

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!