当前位置: 首页>>代码示例>>C#>>正文


C# System.IO.Stream.Read方法代码示例

本文整理汇总了C#中System.IO.Stream.Read方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.Stream.Read方法的具体用法?C# System.IO.Stream.Read怎么用?C# System.IO.Stream.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.Stream的用法示例。


在下文中一共展示了System.IO.Stream.Read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyStream

 private static void CopyStream(Stream input, Stream output)
 {
     byte[] buffer = new byte[32768];
     while (true)
     {
         int read = input.Read(buffer, 0, buffer.Length);
         if (read <= 0)
             return;
         output.Write(buffer, 0, read);
     }
 }
开发者ID:Narmical,项目名称:pickles,代码行数:11,代码来源:HtmlResourceWriter.cs

示例2: Block

		public Block (System.IO.Stream stream)
		{
			this.stream = stream;
			Start = stream.Position;
			name = new byte [4];
			byte [] tmp = new byte [8];
			stream.Read (tmp, 0, tmp.Length);
			System.Array.Copy (tmp, name, name.Length);
			//System.Console.WriteLine (this.Name);
			Length = BitConverter.ToUInt32 (tmp, name.Length, false);
			stream.Position = stream.Position + Length;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:12,代码来源:MrwFile.cs

示例3: GMKIn

 public GMKIn(System.IO.Stream source)
 {
     s = source;
     int tpos = (int)s.Position;
     len = (int)s.Length;
     s.Seek(0, System.IO.SeekOrigin.Begin);
     s.Read(buffer, 0, 16);
     int junk1 = BitConverter.ToInt32(buffer, 8);
     int junk2 = BitConverter.ToInt32(buffer, 12);
     s.Seek(junk1 * 4, System.IO.SeekOrigin.Current);
     s.Read(buffer, 8, 4);
     int seed = BitConverter.ToInt32(buffer, 8);
     table = GenerateSwapTable(seed);
     s.Seek(junk2 * 4, System.IO.SeekOrigin.Current);
     outlen = s.Length - (s.Position - 8L);
     outpos = 0;
     buffer[8] = (byte)s.ReadByte();
     bufferptrin = 9;
     bufferptrout = tpos;
     pos = (int)s.Position;
 }
开发者ID:joshwyant,项目名称:game-creator,代码行数:21,代码来源:GMKIn.cs

示例4: ImageDirectory

		public ImageDirectory (System.IO.Stream stream, uint start, long end, bool little)
		{
			this.start = start;
			this.little = little;
			this.stream = stream;

			entry_list = new System.Collections.ArrayList ();
			
			stream.Position = end - 4;
			byte [] buf = new byte [10];
			stream.Read (buf, 0, 4);
			uint directory_pos  = BitConverter.ToUInt32 (buf, 0, little);
			DirPosition = start + directory_pos;

			stream.Position = DirPosition;
			stream.Read (buf, 0, 2);

			Count = BitConverter.ToUInt16 (buf, 0, little);
			
			for (int i = 0; i < Count; i++)
			{
				stream.Read (buf, 0, 10);
				System.Console.WriteLine ("reading {0} {1}", i, stream.Position);
				Entry entry = new Entry (buf, 0, little);
				entry_list.Add (entry);
			}
		}			
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:27,代码来源:Ciff.cs

示例5: Upload

 /// <summary>
 /// Copies a stream to a Glacier vault archive
 /// </summary>
 /// <param name="stream">
 /// The stream to read
 /// </param>
 /// <returns>
 /// The total number of bytes read
 /// </returns>
 public Int64 Upload(Stream stream)
 {
     var streamLength = 0L;
      for (; ; )
      {
     // if we have filled the current part, then upload it
     if (this.partOffset == PartSize)
        Flush();
     // read the next block from the input stream
     var read = stream.Read(
        this.readBuffer,
        0,
        Math.Min(
           this.readBuffer.Length,
           PartSize - this.partOffset
        )
     );
     if (read == 0)
        break;
     // write the results to the part buffer stream
     this.partStream.Write(this.readBuffer, 0, read);
     this.partOffset += read;
     streamLength += read;
      }
      return streamLength;
 }
开发者ID:bspell1,项目名称:SkyFloe,代码行数:35,代码来源:GlacierUploader.cs


注:本文中的System.IO.Stream.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。