ToStream() public static method

문자열을 기본 인코딩 방식으로 스트림 (System.IO.MemoryStream)의 인스턴스로 변환한다.
public static ToStream ( this s ) : Stream
s this 대상문자열
return Stream
Beispiel #1
0
        public void ConvertToStringToByteToStream()
        {
            var hexBytes  = Encoding.UTF8.GetBytes(OriginalString);
            var hexBytes2 = OriginalString.ToBytes(Encoding.UTF8);

            Assert.AreEqual(hexBytes, hexBytes2);

            var hexBytes3 = StringTool.ToStream(OriginalString, Encoding.UTF8).ToBytes();

            Assert.AreEqual(hexBytes2, hexBytes3);
        }
Beispiel #2
0
        public void CanHexDumpString()
        {
            var dumpString = HexTextTool.GetHexDumpString(HexBytes);

            Assert.IsNotEmpty(dumpString);

            var dumpString2 = HexTextTool.GetHexDumpString(StringTool.ToStream(OriginalString, Encoding.UTF8));

            Assert.IsNotEmpty(dumpString2);

            //Console.WriteLine(dumpString);
            //Console.WriteLine();
            //Console.WriteLine(dumpString2);

            Assert.AreEqual(dumpString, dumpString2);
        }