CSharp examples for System:String Base64
decode the base 64 encoded string data writing it to the given output stream, whitespace characters will be ignored.
using System.Text; using System.IO;// ww w .j a v a 2s . com using System; public class Main{ /** * decode the base 64 encoded string data writing it to the given output stream, * whitespace characters will be ignored. * * @return the number of bytes produced. */ public static int Decode( string data, Stream outStream) { byte[] decoded = Decode(data); outStream.Write(decoded, 0, decoded.Length); return decoded.Length; } /** * decode the base 64 encoded string data - whitespace will be ignored. * * @return a byte array representing the decoded data. */ public static byte[] Decode( string data) { return Convert.FromBase64String(data); } /** * decode the base 64 encoded input data. It is assumed the input data is valid. * * @return a byte array representing the decoded data. */ public static byte[] Decode( byte[] data) { string s = Strings.FromAsciiByteArray(data); return Convert.FromBase64String(s); } }