Package org.verapdf.cos.visitor
Class Writer
- java.lang.Object
-
- org.verapdf.cos.visitor.Writer
-
- All Implemented Interfaces:
IVisitor
- Direct Known Subclasses:
IndirectWriter
public class Writer extends Object implements IVisitor
- Author:
- Timur Kamalov
-
-
Field Summary
Fields Modifier and Type Field Description protected COSDocumentdocumentstatic StringEOLprotected COSXRefInfoinfoprotected InternalOutputStreamosprotected List<COSKey>toWriteprotected List<COSKey>written
-
Constructor Summary
Constructors Constructor Description Writer(COSDocument document, String filename, boolean append, long incrementalOffset)Writer(COSDocument document, String filename, long incrementalOffset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToWrite(List<COSKey> keys)voidaddToWrite(COSKey key)voidaddXRef(COSKey key)protected voidaddXRef(COSKey key, long offset, char free)voidclear()voidclose()voidfreeObjects(Map<COSKey,Long> keys)protected voidgenerateID()protected COSKeygetKeyToWrite(COSKey key)protected longgetOffset()COSXRefInfogetXRefInfo()voidsetTrailer(COSTrailer trailer)voidsetTrailer(COSTrailer trailer, long prev)voidvisitFromArray(COSArray obj)voidvisitFromBoolean(COSBoolean obj)voidvisitFromDictionary(COSDictionary obj)voidvisitFromIndirect(COSIndirect obj)voidvisitFromInteger(COSInteger obj)voidvisitFromName(COSName obj)voidvisitFromNull(COSNull obj)voidvisitFromReal(COSReal obj)voidvisitFromStream(COSStream obj)voidvisitFromString(COSString obj)protected voidwrite(boolean value)protected voidwrite(char value)protected voidwrite(int value)protected voidwrite(long value)protected voidwrite(String value)protected voidwrite(ASAtom value)protected voidwrite(COSKey value)protected voidwrite(COSKey key, COSObject object)protected voidwrite(COSObject value)protected voidwrite(COSXRefEntry value)protected voidwrite(COSXRefRange value)protected voidwrite(COSXRefSection value)voidwriteBody()voidwriteHeader(String header)voidwriteIncrementalUpdate(List<COSObject> changedObjects, List<COSObject> addedObjects)voidwriteXRefInfo()
-
-
-
Field Detail
-
os
protected InternalOutputStream os
-
info
protected COSXRefInfo info
-
document
protected COSDocument document
-
EOL
public static final String EOL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Writer
public Writer(COSDocument document, String filename, long incrementalOffset) throws IOException
- Throws:
IOException
-
Writer
public Writer(COSDocument document, String filename, boolean append, long incrementalOffset) throws IOException
- Throws:
IOException
-
-
Method Detail
-
writeIncrementalUpdate
public void writeIncrementalUpdate(List<COSObject> changedObjects, List<COSObject> addedObjects)
-
visitFromBoolean
public void visitFromBoolean(COSBoolean obj)
- Specified by:
visitFromBooleanin interfaceIVisitor
-
visitFromInteger
public void visitFromInteger(COSInteger obj)
- Specified by:
visitFromIntegerin interfaceIVisitor
-
visitFromReal
public void visitFromReal(COSReal obj)
- Specified by:
visitFromRealin interfaceIVisitor
-
visitFromString
public void visitFromString(COSString obj)
- Specified by:
visitFromStringin interfaceIVisitor
-
visitFromName
public void visitFromName(COSName obj)
- Specified by:
visitFromNamein interfaceIVisitor
-
visitFromArray
public void visitFromArray(COSArray obj)
- Specified by:
visitFromArrayin interfaceIVisitor
-
visitFromDictionary
public void visitFromDictionary(COSDictionary obj)
- Specified by:
visitFromDictionaryin interfaceIVisitor
-
visitFromStream
public void visitFromStream(COSStream obj)
- Specified by:
visitFromStreamin interfaceIVisitor
-
visitFromNull
public void visitFromNull(COSNull obj)
- Specified by:
visitFromNullin interfaceIVisitor
-
visitFromIndirect
public void visitFromIndirect(COSIndirect obj)
- Specified by:
visitFromIndirectin interfaceIVisitor
-
writeHeader
public void writeHeader(String header)
-
addToWrite
public void addToWrite(COSKey key)
-
writeBody
public void writeBody()
-
setTrailer
public void setTrailer(COSTrailer trailer)
-
setTrailer
public void setTrailer(COSTrailer trailer, long prev)
-
writeXRefInfo
public void writeXRefInfo()
-
getXRefInfo
public COSXRefInfo getXRefInfo()
-
clear
public void clear()
-
close
public void close()
-
getOffset
protected long getOffset()
-
write
protected void write(COSKey key, COSObject object) throws IOException
- Throws:
IOException
-
generateID
protected void generateID()
-
addXRef
protected void addXRef(COSKey key, long offset, char free)
-
addXRef
public void addXRef(COSKey key)
-
write
protected void write(boolean value) throws IOException- Throws:
IOException
-
write
protected void write(int value) throws IOException- Throws:
IOException
-
write
protected void write(long value) throws IOException- Throws:
IOException
-
write
protected void write(char value) throws IOException- Throws:
IOException
-
write
protected void write(String value) throws IOException
- Throws:
IOException
-
write
protected void write(ASAtom value) throws IOException
- Throws:
IOException
-
write
protected void write(COSKey value) throws IOException
- Throws:
IOException
-
write
protected void write(COSObject value)
-
write
protected void write(COSXRefRange value) throws IOException
- Throws:
IOException
-
write
protected void write(COSXRefEntry value) throws IOException
- Throws:
IOException
-
write
protected void write(COSXRefSection value) throws IOException
- Throws:
IOException
-
-