Class COSWriterObjectStream
- java.lang.Object
-
- org.apache.pdfbox.pdfwriter.compress.COSWriterObjectStream
-
public class COSWriterObjectStream extends java.lang.ObjectAn instance of this class represents an object stream, that compresses a number ofCOSObjects in a stream. It may be added to the top level container of a written PDF document in place of the compressed objects. The document'sPDFXRefStreammust be adapted accordingly.- Author:
- Christian Appl
-
-
Constructor Summary
Constructors Constructor Description COSWriterObjectStream(COSWriterCompressionPool compressionPool)Creates an object stream for compressible objects from the givenCOSWriterCompressionPool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<COSObjectKey>getPreparedKeys()Returns allCOSObjectKeys, that shall be added to the object stream, whenwriteObjectsToStream(COSStream)is called.voidprepareStreamObject(COSObjectKey key, COSBase object)Prepares the givenCOSObjectto be written to this object stream, using the givenCOSObjectKeyas it's ID for indirect references.COSStreamwriteObjectsToStream(COSStream stream)
-
-
-
Constructor Detail
-
COSWriterObjectStream
public COSWriterObjectStream(COSWriterCompressionPool compressionPool)
Creates an object stream for compressible objects from the givenCOSWriterCompressionPool. The objects must first be prepared for this object stream, by adding them via callingprepareStreamObject(COSObjectKey, COSBase)and will be written to thisCOSStream, whenwriteObjectsToStream(COSStream)is called.- Parameters:
compressionPool- The compression pool an object stream shall be created for.
-
-
Method Detail
-
prepareStreamObject
public void prepareStreamObject(COSObjectKey key, COSBase object)
Prepares the givenCOSObjectto be written to this object stream, using the givenCOSObjectKeyas it's ID for indirect references.- Parameters:
key- TheCOSObjectKey, that shall be used for indirect references to theCOSObject.object- TheCOSObject, that shall be written to this object stream.
-
getPreparedKeys
public java.util.List<COSObjectKey> getPreparedKeys()
Returns allCOSObjectKeys, that shall be added to the object stream, whenwriteObjectsToStream(COSStream)is called.- Returns:
- All
COSObjectKeys, that shall be added to the object stream.
-
writeObjectsToStream
public COSStream writeObjectsToStream(COSStream stream) throws java.io.IOException
- Parameters:
stream- The stream for the compressed objects.- Returns:
- The given
COSStreamof this object stream. - Throws:
java.io.IOException- Shall be thrown, if writing the object stream failed.
-
-