/[classpath]/classpath/gnu/java/security/der/DERReader.java
ViewVC logotype

Diff of /classpath/gnu/java/security/der/DERReader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by rsdio, Sat Aug 14 17:51:42 2004 UTC revision 1.4 by rsdio, Sun Nov 7 20:27:47 2004 UTC
# Line 62  import gnu.java.security.OID; Line 62  import gnu.java.security.OID;
62   *   *
63   * @author Casey Marshall (csm@gnu.org)   * @author Casey Marshall (csm@gnu.org)
64   */   */
65  public final class DERReader implements DER  public class DERReader implements DER
66  {  {
67    
68    // Fields.    // Fields.
69    // ------------------------------------------------------------------------    // ------------------------------------------------------------------------
70    
71    private InputStream in;    protected InputStream in;
72    
73    private final ByteArrayOutputStream encBuf;    protected final ByteArrayOutputStream encBuf;
74    
75    // Constructor.    // Constructor.
76    // ------------------------------------------------------------------------    // ------------------------------------------------------------------------
# Line 185  public final class DERReader implements Line 185  public final class DERReader implements
185      return value;      return value;
186    }    }
187    
188      protected int readLength() throws IOException
189      {
190        int i = in.read();
191        if (i == -1)
192          throw new EOFException();
193        encBuf.write(i);
194        if ((i & ~0x7F) == 0)
195          {
196            return i;
197          }
198        else if (i < 0xFF)
199          {
200            byte[] octets = new byte[i & 0x7F];
201            in.read(octets);
202            encBuf.write(octets);
203            return new BigInteger(1, octets).intValue();
204          }
205        throw new DEREncodingException();
206      }
207    
208    // Own methods.    // Own methods.
209    // ------------------------------------------------------------------------    // ------------------------------------------------------------------------
210    
# Line 236  public final class DERReader implements Line 256  public final class DERReader implements
256        }        }
257    }    }
258    
   private int readLength() throws IOException  
   {  
     int i = in.read();  
     if (i == -1)  
       throw new EOFException();  
     encBuf.write(i);  
     if ((i & ~0x7F) == 0)  
       {  
         return i;  
       }  
     else if (i < 0xFF)  
       {  
         byte[] octets = new byte[i & 0x7F];  
         in.read(octets);  
         encBuf.write(octets);  
         return new BigInteger(1, octets).intValue();  
       }  
     throw new DEREncodingException();  
   }  
   
259    private static String makeString(int tag, byte[] value)    private static String makeString(int tag, byte[] value)
260      throws IOException      throws IOException
261    {    {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26