Package org.apache.pdfbox.pdfparser
Class EndstreamFilterStream
- java.lang.Object
-
- org.apache.pdfbox.pdfparser.EndstreamFilterStream
-
class EndstreamFilterStream extends java.lang.ObjectThis class is only for the readUntilEndStream method, to prevent a final CR LF or LF (but not a final CR!) from being written to the output, unless the beginning of the stream is assumed to be ASCII. This solves PDFBOX-2079 and PDFBOX-2120 and avoids making readUntilEndStream() even more complex than it already is.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanhasCRprivate booleanhasLFprivate longlengthprivate booleanmustFilterprivate intpos
-
Constructor Summary
Constructors Constructor Description EndstreamFilterStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalculateLength()write out a single CR if one was kept.voidfilter(byte[] b, int off, int len)Write CR and/or LF that were kept, then writes len bytes from the specified byte array starting at offset off to this output stream, except trailing CR, CR LF, or LF.
-
-
-
Method Detail
-
filter
public void filter(byte[] b, int off, int len)Write CR and/or LF that were kept, then writes len bytes from the specified byte array starting at offset off to this output stream, except trailing CR, CR LF, or LF. No filtering will be done for the entire stream if the beginning is assumed to be ASCII.- Parameters:
b- byte array.off- offset.len- length of segment to write.
-
calculateLength
public long calculateLength()
write out a single CR if one was kept. Don't write kept CR LF or LF, and then call the base method to flush.
-
-