Package com.tom_roush.pdfbox.pdfwriter
Class COSStandardOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.tom_roush.pdfbox.pdfwriter.COSStandardOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class COSStandardOutputStream extends FilterOutputStream
simple output stream with some minor features for generating "pretty" PDF files.
-
-
Field Summary
Fields Modifier and Type Field Description static byte[]CRLFTo be used when 2 byte sequence is enforced.static byte[]EOLstandard line separator.static byte[]LFLine feed character.-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description COSStandardOutputStream(OutputStream out)Constructor.COSStandardOutputStream(OutputStream out, int position)Deprecated.COSStandardOutputStream(OutputStream out, long position)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetPos()This will get the current position in the stream.booleanisOnNewLine()This will tell if we are on a newline.voidsetOnNewLine(boolean newOnNewLine)This will set a flag telling if we are on a newline.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.voidwriteCRLF()This 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, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
COSStandardOutputStream
public COSStandardOutputStream(OutputStream out)
Constructor.- Parameters:
out- The underlying stream to write to.
-
COSStandardOutputStream
@Deprecated public COSStandardOutputStream(OutputStream out, int position)
Deprecated.Constructor.- Parameters:
out- The underlying stream to write to.position- The current position of output stream.
-
COSStandardOutputStream
public COSStandardOutputStream(OutputStream out, long position)
Constructor.- Parameters:
out- The underlying stream to write to.position- The current position of output stream.
-
-
Method Detail
-
getPos
public long getPos()
This will get the current position in the stream.- Returns:
- The current position in the stream.
-
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
public void write(byte[] b, int off, int len) throws IOExceptionThis 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
public void write(int b) throws IOExceptionThis 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
public void writeCRLF() throws IOExceptionThis will write a CRLF to the stream.- Throws:
IOException- If there is an error writing the data to the stream.
-
writeEOL
public void writeEOL() throws IOExceptionThis will write an EOL to the stream.- Throws:
IOException- If there is an error writing to the stream
-
writeLF
public void writeLF() throws IOExceptionThis will write a Linefeed to the stream.- Throws:
IOException- If there is an error writing to the underlying stream.
-
-