예제 #1
0
        // 写入流
        public static IStream WriteTo(object obj)
        {
            var stream = new DefaultStream(512);

            GetByInstance(obj).WriteTo(obj, stream);
            return(stream);
        }
예제 #2
0
        public static IStream CreateReaderStream(System.IO.BinaryReader reader)
        {
            var cnt = (int)(reader.BaseStream.Length - reader.BaseStream.Position);

            byte[] bytes = new byte[cnt];
            reader.Read(bytes, 0, cnt);
            var stream = new DefaultStream(bytes);

            stream.WritePos = cnt;
            return(stream);
        }