System.Text.BaseCodePageEncoding.GetEncodingDataStream C# (CSharp) Method

GetEncodingDataStream() static private method

static private GetEncodingDataStream ( String tableName ) : Stream
tableName String
return System.IO.Stream
        internal static Stream GetEncodingDataStream(String tableName)
        {
            Debug.Assert(tableName != null, "table name can not be null");

            // NOTE: We must reflect on a public type that is exposed in the contract here
            // (i.e. CodePagesEncodingProvider), otherwise we will not get a reference to
            // the right assembly.
            Stream stream = typeof(CodePagesEncodingProvider).GetTypeInfo().Assembly.GetManifestResourceStream(tableName);

            if (stream == null)
            {
                // We can not continue if we can't get the resource.
                throw new InvalidOperationException();
            }

            // Read the header
            stream.Read(s_codePagesDataHeader, 0, s_codePagesDataHeader.Length);

            return stream;
        }