Package org.apache.pdfbox.pdfwriter
Class COSStandardOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.pdfbox.pdfwriter.COSStandardOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class COSStandardOutputStream extends java.io.FilterOutputStream
simple output stream with some minor features for generating "pretty" pdf files.- Version:
- $Revision: 1.5 $
- Author:
- Michael Traut
-
-
Constructor Summary
Constructors Constructor Description COSStandardOutputStream(java.io.OutputStream out)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getFileInBytes(int[] byteRange)
java.io.InputStream
getFilterInputStream(int[] byteRange)
long
getPos()
This will get the current position in the stream.boolean
isOnNewLine()
This will tell if we are on a newline.void
mark()
void
reset()
void
setOnNewLine(boolean newOnNewLine)
This will set a flag telling if we are on a newline.void
setPos(long pos)
This will set the current position in the stream.void
write(byte[] b, int off, int len)
This will write some byte to the stream.void
write(int b)
This will write a single byte to the stream.void
writeCRLF()
This will write a CRLF to the stream.void
writeEOL()
This will write an EOL to the stream.void
writeLF()
This will write a Linefeed to the stream.
-
-
-
Method Detail
-
getPos
public long getPos()
This will get the current position in the stream.- Returns:
- The current position in the stream.
-
setPos
public void setPos(long pos) throws java.io.IOException
This will set the current position in the stream.- Parameters:
pos
- the to be set position in the stream.- Throws:
java.io.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
public void write(byte[] b, int off, int len) throws java.io.IOException
This will write some byte to the stream.- Overrides:
write
in classjava.io.FilterOutputStream
- Parameters:
b
- The source byte array.off
- The offset into the array to start writing.len
- The number of bytes to write.- Throws:
java.io.IOException
- If the underlying stream throws an exception.
-
write
public void write(int b) throws java.io.IOException
This will write a single byte to the stream.- Overrides:
write
in classjava.io.FilterOutputStream
- Parameters:
b
- The byte to write to the stream.- Throws:
java.io.IOException
- If there is an error writing to the underlying stream.
-
writeCRLF
public void writeCRLF() throws java.io.IOException
This will write a CRLF to the stream.- Throws:
java.io.IOException
- If there is an error writing the data to the stream.
-
writeEOL
public void writeEOL() throws java.io.IOException
This will write an EOL to the stream.- Throws:
java.io.IOException
- If there is an error writing to the stream
-
writeLF
public void writeLF() throws java.io.IOException
This will write a Linefeed to the stream.- Throws:
java.io.IOException
- If there is an error writing to the underlying stream.
-
mark
public void mark() throws java.io.IOException
- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
- Throws:
java.io.IOException
-
getFileInBytes
public byte[] getFileInBytes(int[] byteRange) throws java.io.IOException
- Throws:
java.io.IOException
-
getFilterInputStream
public java.io.InputStream getFilterInputStream(int[] byteRange)
-
-