public CmsTypedStream GetContent()
        {
            try
            {
                CompressedDataParser comData = new CompressedDataParser((Asn1SequenceParser)this.contentInfo.GetContent(Asn1Tags.Sequence));
                ContentInfoParser content = comData.GetEncapContentInfo();

                Asn1OctetStringParser bytes = (Asn1OctetStringParser)content.GetContent(Asn1Tags.OctetString);

                return new CmsTypedStream(content.ContentType.ToString(), new ZInputStream(bytes.GetOctetStream()));
            }
            catch (IOException e)
            {
                throw new CmsException("IOException reading compressed content.", e);
            }
        }
		public void TestNestedStructure()
		{
			MemoryStream bOut = new MemoryStream();

			BerSequenceGenerator sGen = new BerSequenceGenerator(bOut);

			sGen.AddObject(new DerObjectIdentifier(CmsObjectIdentifiers.CompressedData.Id));

			BerSequenceGenerator cGen = new BerSequenceGenerator(sGen.GetRawOutputStream(), 0, true);

			cGen.AddObject(new DerInteger(0));

			//
			// AlgorithmIdentifier
			//
			DerSequenceGenerator algGen = new DerSequenceGenerator(cGen.GetRawOutputStream());

			algGen.AddObject(new DerObjectIdentifier("1.2"));

			algGen.Close();

			//
			// Encapsulated ContentInfo
			//
			BerSequenceGenerator eiGen = new BerSequenceGenerator(cGen.GetRawOutputStream());

			eiGen.AddObject(new DerObjectIdentifier("1.1"));

			BerOctetStringGenerator octGen = new BerOctetStringGenerator(eiGen.GetRawOutputStream(), 0, true);

			//
			// output containing zeroes
			//
			Stream outStream = octGen.GetOctetOutputStream();

			outStream.Write(new byte[] { 1, 2, 3, 4 }, 0, 4);
			outStream.Write(new byte[4], 0, 4);
			outStream.Write(new byte[20], 0, 20);

			outStream.Close();
			eiGen.Close();
			cGen.Close();
			sGen.Close();

			//
			// reading back
			//
			Asn1StreamParser aIn = new Asn1StreamParser(bOut.ToArray());

			ContentInfoParser cp = new ContentInfoParser((Asn1SequenceParser)aIn.ReadObject());

			CompressedDataParser comData = new CompressedDataParser((Asn1SequenceParser)cp.GetContent(Asn1Tags.Sequence));
			ContentInfoParser content = comData.GetEncapContentInfo();

			Asn1OctetStringParser bytes = (Asn1OctetStringParser)content.GetContent(Asn1Tags.OctetString);

			Stream inStream = bytes.GetOctetStream();
			int count = 0;

			while (inStream.ReadByte() >= 0)
			{
				count++;
			}

			Assert.AreEqual(28, count);
		}