1 package org.bouncycastle.asn1; 2 3 import java.io.InputStream; 4 import java.io.IOException; 5 6 public class DEROctetStringParser 7 implements ASN1OctetStringParser 8 { 9 private DefiniteLengthInputStream stream; 10 DEROctetStringParser( DefiniteLengthInputStream stream)11 DEROctetStringParser( 12 DefiniteLengthInputStream stream) 13 { 14 this.stream = stream; 15 } 16 getOctetStream()17 public InputStream getOctetStream() 18 { 19 return stream; 20 } 21 getDERObject()22 public DERObject getDERObject() 23 { 24 try 25 { 26 return new DEROctetString(stream.toByteArray()); 27 } 28 catch (IOException e) 29 { 30 throw new ASN1ParsingException("IOException converting stream to byte array: " + e.getMessage(), e); 31 } 32 } 33 } 34