Index: COSArray.java
===================================================================
--- COSArray.java	(Revision 1040308)
+++ COSArray.java	(Arbeitskopie)
@@ -207,7 +207,7 @@
      */
     public COSBase get( int index )
     {
-        return (COSBase)objects.get( index );
+        return objects.get( index );
     }
 
     /**
@@ -356,7 +356,7 @@
      */
     public COSBase remove( int i )
     {
-        return (COSBase)objects.remove( i );
+        return objects.remove( i );
     }
 
     /**
@@ -404,6 +404,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public String toString()
     {
         return "COSArray{" + objects + "}";
@@ -503,6 +504,7 @@
      * @return any object, depending on the visitor implementation, or null
      * @throws COSVisitorException If an error occurs while visiting this object.
      */
+    @Override
     public Object accept(ICOSVisitor visitor) throws COSVisitorException
     {
         return visitor.visitFromArray(this);
Index: COSBase.java
===================================================================
--- COSBase.java	(Revision 1040308)
+++ COSBase.java	(Arbeitskopie)
@@ -32,8 +32,14 @@
     /**
      * Constructor.
      */
+  
+    private boolean needToBeUpdate;
+    
+    private boolean direct;
+  
     public COSBase()
     {
+      needToBeUpdate = false;
     }
 
     /**
@@ -69,4 +75,36 @@
      * @throws COSVisitorException If an error occurs while visiting this object.
      */
     public abstract Object accept(ICOSVisitor visitor) throws COSVisitorException;
+    
+    public void setNeedToBeUpdate(boolean flag) 
+    {
+      needToBeUpdate = flag;
+    }
+    
+    /**
+     * If the state is set true, the dictionary will be written direct into the called object. 
+     * This means, no indirect object will be created.
+     * 
+     * @return the state
+     */
+    public boolean isDirect() 
+    {
+        return direct;
+    }
+    
+    /**
+     * Set the state true, if the dictionary should be written as a direct object and not indirect.
+     * 
+     * @param direct set it true, for writting direct object
+     */
+    public void setDirect(boolean direct)
+    {
+      this.direct = direct;
+    }
+    
+    public boolean isNeedToBeUpdate() 
+    {
+      return needToBeUpdate;
+    }
+
 }
Index: COSName.java
===================================================================
--- COSName.java	(Revision 1040308)
+++ COSName.java	(Arbeitskopie)
@@ -975,6 +975,56 @@
      */
     public static final byte[] NAME_ESCAPE = new byte[] { 35  };  //The # character
 
+    /**
+     * A common COSName value.
+     */
+    public static final COSName SUBFILTER = new COSName("SubFilter");
+    /**
+     * A signature filter value.
+     */
+    public static final COSName ADOBE_PPKLITE = new COSName("Adobe.PPKLite");
+    /**
+     * A signature filter value.
+     */
+    public static final COSName ENTRUST_PPKEF = new COSName("Entrust.PPKEF");
+    /**
+     * A signature filter value.
+     */
+    public static final COSName CICI_SIGNIT = new COSName("CICI.SignIt");
+    /**
+     * A signature filter value.
+     */
+    public static final COSName VERISIGN_PPKVS = new COSName("VeriSign.PPKVS");
+    /**
+     * A signature subfilter value.
+     */
+    public static final COSName ADBE_X509_RSA_SHA1 = new COSName("adbe.x509.rsa_sha1");
+    /**
+     * A signature subfilter value.
+     */
+    public static final COSName ADBE_PKCS7_DETACHED = new COSName("adbe.pkcs7.detached");
+    /**
+     * A signature subfilter value.
+     */
+    public static final COSName ADBE_PKCS7_SHA1 = new COSName("adbe.pkcs7.sha1");
+    /**
+     * A common COSName value.
+     */
+    public static final COSName LOCATION = new COSName("Location");
+    /**
+     * A common COSName value.
+     */
+    public static final COSName REASON = new COSName("Reason");
+    /**
+     * A common COSName value.
+     */
+    public static final COSName BYTERANGE = new COSName("ByteRange");
+    /**
+     * A common COSName value.
+     */
+    public static final COSName SIG = new COSName("Sig");
+
+    
     private String name;
     private int hashCode;
 
Index: COSString.java
===================================================================
--- COSString.java	(Revision 1040308)
+++ COSString.java	(Arbeitskopie)
@@ -21,10 +21,9 @@
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.pdfbox.exceptions.COSVisitorException;
 import org.apache.pdfbox.persistence.util.COSHEXTable;
 
-import org.apache.pdfbox.exceptions.COSVisitorException;
-
 /**
  * This represents a string object in a PDF document.
  *
@@ -83,6 +82,10 @@
      */
     private boolean forceLiteralForm = false;
 
+    /**
+     * Forces the string to be serialized in hex form but not literal form.
+     */
+    private boolean forceHexForm = false;
 
     /**
      * Constructor.
@@ -166,6 +169,18 @@
     }
 
     /**
+     * Forces the string to be written in hexadecimal form instead of literal form.
+     * 
+     * @param v if v is true the string will be written in hexadecimal form otherwise it will be written in literal if
+     *          necessary.
+     */
+
+    public void setForceHexForm(boolean v)
+    {
+      forceHexForm = v;
+    }
+    
+    /**
      * This will create a COS string from a string of hex characters.
      *
      * @param hex A hex string.
@@ -322,6 +337,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public String toString()
     {
         return "COSString{" + this.getString() + "}";
@@ -345,7 +361,7 @@
             //outside the ASCII range.
             outsideASCII = bytes[i] <0;
         }
-        if( !outsideASCII || forceLiteralForm )
+        if ((!outsideASCII || forceLiteralForm) && !forceHexForm)
         {
             output.write(STRING_OPEN);
             for( int i=0; i<length; i++ )
@@ -358,7 +374,7 @@
                     case '\\':
                     {
                         output.write(ESCAPE);
-                        output.write(b);
+                        output.write((byte)b);
                         break;
                     }
                     case 10: //LF
@@ -388,7 +404,7 @@
                     }
                     default:
                     {
-                        output.write( b );
+                        output.write( (byte)b );
                     }
                 }
             }
@@ -414,6 +430,7 @@
      * @return any object, depending on the visitor implementation, or null
      * @throws COSVisitorException If an error occurs while visiting this object.
      */
+    @Override
     public Object accept(ICOSVisitor visitor) throws COSVisitorException
     {
         return visitor.visitFromString( this );
@@ -422,6 +439,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean equals(Object obj)
     {
         if (obj instanceof COSString)
@@ -435,6 +453,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public int hashCode()
     {
         return getString().hashCode();
