stdlibXtf

Library that read the content of eXtended Triton Format files

Download as .zip Download as .tar.gz View on GitHub

ArrayToStream (Static Class)

Namespace: stdlibXtf

Static class that contain methods to convert an array of bytes in to a System.IO.MemoryStream.

Methods

BytesToMemory(byte[]) Return a MemoryStream object containing the bytes passed to it.

Examples

The following code example illustrate the use of ArrayToStream class method.

using System;
using stdlibXtf;

class ArrayToStreamDemo
{
    public static void Main()
    {
        byte[] byteArray = new byte[4] { 15, 10, 12, 14 };
        using (BinaryReader bs = new BinaryReader(ArrayToStream.BytesToMemory(byteArray)))
        {
            Console.WriteLine("This example convert the bytes 0xFACE to the corresponding unsigned integer value.")
            UInt16 anInt = bs.ReadUInt16();
            Console.WriteLine(String.Format("Conversion result: {0}", anInt))
        }
    }
}

/*
This example convert the bytes 0xFACE to the corresponding unsigned integer value.
Conversion result: 64206
*/

Remarks

remarks ...