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

public Class COSStandardOutputStream

extends FilterOutputStream
Class Inheritance
Imports
java.io.FilterOutputStream, .IOException, .OutputStream

simple output stream with some minor features for generating "pretty" PDF files.
Author
Michael Traut

Field Summary

Modifier and TypeField and Description
public static final byte[]
CRLF

To be used when 2 byte sequence is enforced.

public static final byte[]
EOL

standard line separator.

public static final byte[]
LF

Line feed character.

private boolean
private long
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
COSStandardOutputStream(OutputStream
The underlying stream to write to.
out
)

Constructor.

public
COSStandardOutputStream(OutputStream
The underlying stream to write to.
out
,
long
The current position of output stream.
position
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

The current position in the stream.
getPos
()

This will get the current position in the stream.

public boolean

Returns:

true If we are on a newline.
isOnNewLine
()

This will tell if we are on a newline.

public void
setOnNewLine(boolean
The new value for the onNewLine attribute.
newOnNewLine
)

This will set a flag telling if we are on a newline.

public void
write(byte[]
The source byte array.
b
,
int
The offset into the array to start writing.
off
,
int
The number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

This will write some byte to the stream.

public void
write(int
The byte to write to the stream.
b
)

Overrides java.io.FilterOutputStream.write.

This will write a single byte to the stream.

public void
writeCRLF()

This will write a CRLF to the stream.

public void
writeEOL()

This will write an EOL to the stream.

public void
writeLF()

This will write a Linefeed to the stream.

Inherited from java.io.FilterOutputStream:
closeflushwrite

Field Detail

CRLFback to summary
public static final byte[] CRLF

To be used when 2 byte sequence is enforced.

EOLback to summary
public static final byte[] EOL

standard line separator.

LFback to summary
public static final byte[] LF

Line feed character.

onNewLineback to summary
private boolean onNewLine
positionback to summary
private long position

Constructor Detail

COSStandardOutputStreamback to summary
public COSStandardOutputStream(OutputStream out)

Constructor.

Parameters
out:OutputStream

The underlying stream to write to.

COSStandardOutputStreamback to summary
public COSStandardOutputStream(OutputStream out, long position)

Constructor.

Parameters
out:OutputStream

The underlying stream to write to.

position:long

The current position of output stream.

Method Detail

getPosback to summary
public long getPos()

This will get the current position in the stream.

Returns:long

The current position in the stream.

isOnNewLineback to summary
public boolean isOnNewLine()

This will tell if we are on a newline.

Returns:boolean

true If we are on a newline.

setOnNewLineback to summary
public void setOnNewLine(boolean newOnNewLine)

This will set a flag telling if we are on a newline.

Parameters
newOnNewLine:boolean

The new value for the onNewLine attribute.

writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

This will write some byte to the stream.

Parameters
b:byte[]

The source byte array.

off:int

The offset into the array to start writing.

len:int

The number of bytes to write.

Annotations
@Override
Exceptions
IOException:
If the underlying stream throws an exception.
writeback to summary
public void write(int b) throws IOException

Overrides java.io.FilterOutputStream.write.

This will write a single byte to the stream.

Parameters
b:int

The byte to write to the stream.

Annotations
@Override
Exceptions
IOException:
If there is an error writing to the underlying stream.
writeCRLFback to summary
public void writeCRLF() throws IOException

This will write a CRLF to the stream.

Exceptions
IOException:
If there is an error writing the data to the stream.
writeEOLback to summary
public void writeEOL() throws IOException

This will write an EOL to the stream.

Exceptions
IOException:
If there is an error writing to the stream
writeLFback to summary
public void writeLF() throws IOException

This will write a Linefeed to the stream.

Exceptions
IOException:
If there is an error writing to the underlying stream.