summary refs log tree commit diff
path: root/crypto/src/cms/CMSProcessableByteArray.cs
blob: 4bee4f8bd3989da1e22554e3c58011e68487f1cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.IO;

namespace Org.BouncyCastle.Cms
{
	/**
	* a holding class for a byte array of data to be processed.
	*/
	public class CmsProcessableByteArray
		: CmsProcessable, CmsReadable
	{
		private readonly byte[] bytes;

		public CmsProcessableByteArray(
			byte[] bytes)
		{
			this.bytes = bytes;
		}

		public Stream GetInputStream()
		{
			return new MemoryStream(bytes, false);
		}

		public virtual void Write(Stream zOut)
		{
			zOut.Write(bytes, 0, bytes.Length);
		}

		/// <returns>A clone of the byte array</returns>
		public virtual object GetContent()
		{
			return bytes.Clone();
		}
	}
}