标签:style blog class code java tar javascript color get int rgb
#region -- 流操作 /// <summary> /// 复制流 /// </summary> public static MemoryStream CopyStream(Stream stream) { MemoryStream mstream = new MemoryStream(); CopyStream(stream, mstream); return mstream; } /// <summary> /// 复制流 /// </summary> public static void CopyStream(Stream source, Stream target) { byte[] bytes = new byte[1024];//临时字节数据数组 if (source.CanRead) { while (true) { int length = source.Read(bytes, 0, bytes.Length); target.Write(bytes, 0, length); if (length < bytes.Length) { break; } } } } /// <summary> /// Stream转字节数组 /// </summary> /// <returns></returns> public static byte[] ReadStream(Stream stream) { using (MemoryStream mstream = new MemoryStream()) { CopyStream(stream, mstream); return mstream.ToArray(); } } #endregion
标签:style blog class code java tar javascript color get int rgb
原文地址:http://www.cnblogs.com/gateluck/p/3700695.html