Package org.apache.pdfbox.pdfwriter
Class COSStandardOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.pdfbox.pdfwriter.COSStandardOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
simple output stream with some minor features for generating "pretty"
pdf files.
- Version:
- $Revision: 1.5 $
- Author:
- Michael Traut
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[]To be used when 2 byte sequence is enforced.static final byte[]standard line separator.static final byte[]Line feed character.Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getFileInBytes(int[] byteRange) getFilterInputStream(int[] byteRange) longgetPos()This will get the current position in the stream.booleanThis will tell if we are on a newline.voidmark()voidreset()voidsetOnNewLine(boolean newOnNewLine) This will set a flag telling if we are on a newline.voidsetPos(long pos) This will set the current position in the stream.voidwrite(byte[] b, int off, int len) This will write some byte to the stream.voidwrite(int b) This will write a single byte to the stream.voidThis will write a CRLF to the stream.voidwriteEOL()This will write an EOL to the stream.voidwriteLF()This will write a Linefeed to the stream.Methods inherited from class java.io.FilterOutputStream
close, flush, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
CRLF
public static final byte[] CRLFTo be used when 2 byte sequence is enforced. -
LF
public static final byte[] LFLine feed character. -
EOL
public static final byte[] EOLstandard line separator.
-
-
Constructor Details
-
COSStandardOutputStream
Constructor.- Parameters:
out- The underlying stream to write to.
-
-
Method Details
-
getPos
public long getPos()This will get the current position in the stream.- Returns:
- The current position in the stream.
-
setPos
This will set the current position in the stream.- Parameters:
pos- the to be set position in the stream.- Throws:
IOException
-
isOnNewLine
public boolean isOnNewLine()This will tell if we are on a newline.- Returns:
- true If we are on a newline.
-
setOnNewLine
public void setOnNewLine(boolean newOnNewLine) This will set a flag telling if we are on a newline.- Parameters:
newOnNewLine- The new value for the onNewLine attribute.
-
write
This will write some byte to the stream.- Overrides:
writein classFilterOutputStream- Parameters:
b- The source byte array.off- The offset into the array to start writing.len- The number of bytes to write.- Throws:
IOException- If the underlying stream throws an exception.
-
write
This will write a single byte to the stream.- Overrides:
writein classFilterOutputStream- Parameters:
b- The byte to write to the stream.- Throws:
IOException- If there is an error writing to the underlying stream.
-
writeCRLF
This will write a CRLF to the stream.- Throws:
IOException- If there is an error writing the data to the stream.
-
writeEOL
This will write an EOL to the stream.- Throws:
IOException- If there is an error writing to the stream
-
writeLF
This will write a Linefeed to the stream.- Throws:
IOException- If there is an error writing to the underlying stream.
-
mark
- Throws:
IOException
-
reset
- Throws:
IOException
-
getFileInBytes
- Throws:
IOException
-
getFilterInputStream
-