Top Description Fields Constructors Methods
org.apache.pdfbox.pdfparser

pack-priv Class EndstreamFilterStream

extends Object
Class Inheritance

This 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.
Author
Tilman Hausherr

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private long
private boolean
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public long
calculateLength()

write out a single CR if one was kept.

public void
filter(byte[]
byte array.
b
,
int
offset.
off
,
int
length of segment to write.
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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hasCRback to summary
private boolean hasCR
hasLFback to summary
private boolean hasLF
lengthback to summary
private long length
mustFilterback to summary
private boolean mustFilter
posback to summary
private int pos

Constructor Detail

EndstreamFilterStreamback to summary
pack-priv EndstreamFilterStream()

Method Detail

calculateLengthback to summary
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.

filterback to summary
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[]

byte array.

off:int

offset.

len:int

length of segment to write.