I am reading the PDFTextStripper.java code and I am stuck trying to
understand a mechanism used within the code.

Following is the getText() method:

    public String getText( PDDocument doc ) throws IOException
    {
        StringWriter outputStream = new StringWriter();
        writeText( doc, outputStream );
        return outputStream.toString();
    }

As you can see, getText() calls writeText() with an outputStream.  In
writeText(), the global variable "Writer output" is set to outputStream:

    output = outputStream;

But there is no code that sets outputStream back to output.  Nevertheless,
outputStream.toString() (in getText) returns the extracted text.

I know I am missing something here, and any help will be appreciated.  If
you think I should post this to the developers' list, please let me know.

Thanks so much.

PS: I am using the latest version of PDFBox 1.8.8.

Reply via email to