You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Andrea Vacondio <an...@gmail.com> on 2015/04/02 15:36:07 UTC
parseCOSStream defined twice
I see parseCOSStream is defined in BaseParser and COSParser is it on
purpose? They kinda look like duplicates so I was wandering if it's a
mistake and one can go.
Re: parseCOSStream defined twice
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 02.04.2015 um 15:36 schrieb Andrea Vacondio:
> I see parseCOSStream is defined in BaseParser and COSParser is it on
> purpose? They kinda look like duplicates so I was wandering if it's a
> mistake and one can go.
>
I found one roadblock: COSParser expects a seekable input stream for the
validateStreamLength method. This isn't obvious, because
PushBackInputStream offers a seek() method. However that one is
supported only if its construction input stream implements RandomAccessRead.
BaseParser doesn't need the seek, but the code is more complex, and
needs more space in its PushBackInputStream. BaseParser is used e.g. for
content streams in COSStreamArray:
return new SequenceInputStream( inputStreams.elements() );
which is why it can't be made seekable.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: parseCOSStream defined twice
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 02.04.2015 um 15:36 schrieb Andrea Vacondio:
> I see parseCOSStream is defined in BaseParser and COSParser is it on
> purpose? They kinda look like duplicates so I was wandering if it's a
> mistake and one can go.
It's not a mistake... in the early days, there was the sequential
parser. Later, there was the non Sequential parser which is more spec
conforming and which was "all new". The nonSequential parser has been
renamed to COSParser and the old parser was deleted (still exists in
1.8.*), except for parts that were still being used. I tried to replace
one with the other, either it didn't work at all, or there was trouble
with rendering. But I agree that it should be investigated what parts of
the method are duplicate.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org