StreamToByteArray() 공개 정적인 메소드

public static StreamToByteArray ( Stream inStream ) : byte[]
inStream Stream
리턴 byte[]
예제 #1
0
 public byte[] GetContent(
     ICipherParameters key)
 {
     try
     {
         return(CmsUtilities.StreamToByteArray(GetContentStream(key).ContentStream));
     }
     catch (IOException e)
     {
         throw new Exception("unable to parse internal stream: " + e);
     }
 }
 public byte[] GetContent(ICipherParameters key)
 {
     //IL_0015: Expected O, but got Unknown
     try
     {
         return(CmsUtilities.StreamToByteArray(GetContentStream(key).ContentStream));
     }
     catch (IOException val)
     {
         IOException val2 = val;
         throw new global::System.Exception(string.Concat((object)"unable to parse internal stream: ", (object)val2));
     }
 }
예제 #3
0
 public byte[] GetContent(ICipherParameters key)
 {
     byte[] result;
     try
     {
         result = CmsUtilities.StreamToByteArray(this.GetContentStream(key).ContentStream);
     }
     catch (IOException arg)
     {
         throw new Exception("unable to parse internal stream: " + arg);
     }
     return(result);
 }
예제 #4
0
        /**
         * Return the uncompressed content, throwing an exception if the data size
         * is greater than the passed in limit. If the content is exceeded getCause()
         * on the CMSException will contain a StreamOverflowException
         *
         * @param limit maximum number of bytes to read
         * @return the content read
         * @throws CMSException if there is an exception uncompressing the data.
         */
        public byte[] GetContent(int limit)
        {
            CompressedData comData = CompressedData.GetInstance(contentInfo.Content);
            ContentInfo    content = comData.EncapContentInfo;

            Asn1OctetString bytes = (Asn1OctetString)content.Content;

            ZInflaterInputStream zIn = new ZInflaterInputStream(new MemoryStream(bytes.GetOctets(), false));

            try
            {
                return(CmsUtilities.StreamToByteArray(zIn, limit));
            }
            catch (IOException e)
            {
                throw new CmsException("exception reading compressed stream.", e);
            }
        }
        public byte[] GetContent(
            ICipherParameters key)
        {
            try
            {
                if (data is MemoryStream)
                {
//					data.Reset();
                    data.Seek(0L, SeekOrigin.Begin);
                }

                return(CmsUtilities.StreamToByteArray(GetContentStream(key).ContentStream));
            }
            catch (IOException e)
            {
                throw new Exception("unable to parse internal stream: " + e);
            }
        }
예제 #6
0
        public byte[] GetContent(int limit)
        {
            CompressedData  instance         = CompressedData.GetInstance(this.contentInfo.Content);
            ContentInfo     encapContentInfo = instance.EncapContentInfo;
            Asn1OctetString asn1OctetString  = (Asn1OctetString)encapContentInfo.Content;
            ZInputStream    inStream         = new ZInputStream(new MemoryStream(asn1OctetString.GetOctets(), false));

            byte[] result;
            try
            {
                result = CmsUtilities.StreamToByteArray(inStream, limit);
            }
            catch (IOException e)
            {
                throw new CmsException("exception reading compressed stream.", e);
            }
            return(result);
        }
예제 #7
0
        public byte[] GetContent(int limit)
        {
            //IL_002b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0035: Expected O, but got Unknown
            //IL_0043: Expected O, but got Unknown
            CompressedData  instance         = CompressedData.GetInstance(contentInfo.Content);
            ContentInfo     encapContentInfo = instance.EncapContentInfo;
            Asn1OctetString asn1OctetString  = (Asn1OctetString)encapContentInfo.Content;
            ZInputStream    inStream         = new ZInputStream((Stream) new MemoryStream(asn1OctetString.GetOctets(), false));

            try
            {
                return(CmsUtilities.StreamToByteArray((Stream)(object)inStream, limit));
            }
            catch (IOException val)
            {
                IOException e = val;
                throw new CmsException("exception reading compressed stream.", (global::System.Exception)(object) e);
            }
        }
예제 #8
0
        /**
         * Return the uncompressed content.
         *
         * @return the uncompressed content
         * @throws CmsException if there is an exception uncompressing the data.
         */
        public byte[] GetContent()
        {
            CompressedData comData = CompressedData.GetInstance(contentInfo.Content);
            ContentInfo    content = comData.EncapContentInfo;

            Asn1OctetString      bytes = (Asn1OctetString)content.Content;
            ZInflaterInputStream zIn   = new ZInflaterInputStream(bytes.GetOctetStream());

            try
            {
                return(CmsUtilities.StreamToByteArray(zIn));
            }
            catch (IOException e)
            {
                throw new CmsException("exception reading compressed stream.", e);
            }
            finally
            {
                zIn.Close();
            }
        }
예제 #9
0
        public byte[] GetContent()
        {
            //IL_003c: Expected O, but got Unknown
            CompressedData  instance         = CompressedData.GetInstance(contentInfo.Content);
            ContentInfo     encapContentInfo = instance.EncapContentInfo;
            Asn1OctetString asn1OctetString  = (Asn1OctetString)encapContentInfo.Content;
            ZInputStream    zInputStream     = new ZInputStream(asn1OctetString.GetOctetStream());

            try
            {
                return(CmsUtilities.StreamToByteArray((Stream)(object)zInputStream));
            }
            catch (IOException val)
            {
                IOException e = val;
                throw new CmsException("exception reading compressed stream.", (global::System.Exception)(object) e);
            }
            finally
            {
                Platform.Dispose((Stream)(object)zInputStream);
            }
        }
예제 #10
0
        public byte[] GetContent()
        {
            CompressedData  instance         = CompressedData.GetInstance(this.contentInfo.Content);
            ContentInfo     encapContentInfo = instance.EncapContentInfo;
            Asn1OctetString asn1OctetString  = (Asn1OctetString)encapContentInfo.Content;
            ZInputStream    zInputStream     = new ZInputStream(asn1OctetString.GetOctetStream());

            byte[] result;
            try
            {
                result = CmsUtilities.StreamToByteArray(zInputStream);
            }
            catch (IOException e)
            {
                throw new CmsException("exception reading compressed stream.", e);
            }
            finally
            {
                zInputStream.Close();
            }
            return(result);
        }