directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r279849 - /directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java
Date Fri, 09 Sep 2005 19:22:11 GMT
Author: elecharny
Date: Fri Sep  9 12:22:07 2005
New Revision: 279849

URL: http://svn.apache.org/viewcvs?rev=279849&view=rev
Log:
Backport from head

Modified:
    directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java

Modified: directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java?rev=279849&r1=279848&r2=279849&view=diff
==============================================================================
--- directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java
(original)
+++ directory/asn1/branches/asn1-new-ber/der/src/java/org/apache/asn1/der/DERTaggedObject.java
Fri Sep  9 12:22:07 2005
@@ -26,10 +26,20 @@
 public class DERTaggedObject implements DEREncodable
 {
     protected int tag;
-    protected boolean empty    = false;
+    protected boolean empty = false;
     protected boolean explicit = true;
-    protected DEREncodable obj = null;
-    
+    protected DEREncodable obj;
+    private byte[] bytes;
+
+    /**
+     * create an implicitly tagged object that contains a zero
+     * length sequence.
+     */
+    public DERTaggedObject( int tag )
+    {
+        this( false, tag, new DERSequence() );
+    }
+
     /**
      * @param tag the tag number for this object.
      * @param obj the tagged object.
@@ -43,7 +53,7 @@
 
     /**
      * @param explicit true if an explicitly tagged object.
-     * @param tagNo the tag number for this object.
+     * @param tag the tag number for this object.
      * @param obj the tagged object.
      */
     public DERTaggedObject( boolean explicit, int tag, DEREncodable obj )
@@ -52,21 +62,25 @@
         this.tag = tag;
         this.obj = obj;
     }
-    
-    /**
-     * create an implicitly tagged object that contains a zero
-     * length sequence.
-     */
-    public DERTaggedObject( int tag )
+
+    public DERTaggedObject( boolean explicit, int tag, DEREncodable obj, byte[] bytes )
     {
-        this( false, tag, new DERSequence() );
+        this.explicit = explicit;
+        this.tag = tag;
+        this.obj = obj;
+        this.bytes = bytes;
     }
-    
+
+    public byte[] getOctets()
+    {
+        return bytes;
+    }
+
     public int getTagNo()
     {
         return tag;
     }
-    
+
     /**
      * return whatever was following the tag.
      * <p>
@@ -84,8 +98,7 @@
         return null;
     }
 
-    public void encode( ASN1OutputStream out )
-        throws IOException
+    public void encode( ASN1OutputStream out ) throws IOException
     {
         if ( !empty )
         {
@@ -106,11 +119,11 @@
                 // need to mark constructed types
                 if ( ( bytes[ 0 ] & DERObject.CONSTRUCTED ) != 0 )
                 {
-                    bytes[ 0 ] = (byte)( DERObject.CONSTRUCTED | DERObject.TAGGED | tag );
+                    bytes[ 0 ] = (byte) ( DERObject.CONSTRUCTED | DERObject.TAGGED | tag
);
                 }
                 else
                 {
-                    bytes[ 0 ] = (byte)( DERObject.TAGGED | tag );
+                    bytes[ 0 ] = (byte) ( DERObject.TAGGED | tag );
                 }
 
                 out.write( bytes );
@@ -122,4 +135,3 @@
         }
     }
 }
-



Mime
View raw message