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


C# OutputStream.Flush方法代码示例

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


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

示例1: WriteTo

		/// <exception cref="System.IO.IOException"></exception>
		public override void WriteTo(OutputStream @out)
		{
			if (@out == null)
			{
				throw new ArgumentException("Output stream may not be null");
			}
			try
			{
				byte[] tmp = new byte[4096];
				int l;
				while ((l = [email protected](tmp)) != -1)
				{
					@out.Write(tmp, 0, l);
				}
				@out.Flush();
			}
			finally
			{
				[email protected]();
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:22,代码来源:InputStreamBody.cs

示例2: WriteTo

		/// <exception cref="System.IO.IOException"></exception>
		public override void WriteTo(OutputStream @out)
		{
			if (@out == null)
			{
				throw new ArgumentException("Output stream may not be null");
			}
			InputStream @in = new ByteArrayInputStream(this.content);
			byte[] tmp = new byte[4096];
			int l;
			while ((l = @in.Read(tmp)) != -1)
			{
				@out.Write(tmp, 0, l);
			}
			@out.Flush();
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:16,代码来源:StringBody.cs

示例3: _get


//.........这里部分代码省略.........
					int i = buf.GetInt();
					ThrowStatusError(buf, i);
				}
				byte[] handle = buf.GetString();
				// filename
				long offset = 0;
				if (mode == RESUME)
				{
					offset += skip;
				}
				int request_len = 0;
				while (true)
				{
					request_len = buf.buffer.Length - 13;
					if (server_version == 0)
					{
						request_len = 1024;
					}
					SendREAD(handle, offset, request_len);
					header = Header(buf, header);
					length = header.length;
					type = header.type;
					if (type == SSH_FXP_STATUS)
					{
						Fill(buf, length);
						int i = buf.GetInt();
						if (i == SSH_FX_EOF)
						{
							goto loop_break;
						}
						ThrowStatusError(buf, i);
					}
					if (type != SSH_FXP_DATA)
					{
						goto loop_break;
					}
					buf.Rewind();
					Fill(buf.buffer, 0, 4);
					length -= 4;
					int i_1 = buf.GetInt();
					// length of data 
					int foo = i_1;
					while (foo > 0)
					{
						int bar = foo;
						if (bar > buf.buffer.Length)
						{
							bar = buf.buffer.Length;
						}
						i_1 = io_in.Read(buf.buffer, 0, bar);
						if (i_1 < 0)
						{
							goto loop_break;
						}
						int data_len = i_1;
						dst.Write(buf.buffer, 0, data_len);
						offset += data_len;
						foo -= data_len;
						if (monitor != null)
						{
							if (!monitor.Count(data_len))
							{
								while (foo > 0)
								{
									i_1 = io_in.Read(buf.buffer, 0, (buf.buffer.Length < foo ? buf.buffer.Length : foo
										));
									if (i_1 <= 0)
									{
										break;
									}
									foo -= i_1;
								}
								goto loop_break;
							}
						}
					}
loop_continue: ;
				}
loop_break: ;
				//System.err.println("length: "+length);  // length should be 0
				dst.Flush();
				if (monitor != null)
				{
					monitor.End();
				}
				_sendCLOSE(handle, header);
			}
			catch (Exception e)
			{
				if (e is SftpException)
				{
					throw (SftpException)e;
				}
				if (e is Exception)
				{
					throw new SftpException(SSH_FX_FAILURE, string.Empty, (Exception)e);
				}
				throw new SftpException(SSH_FX_FAILURE, string.Empty);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:101,代码来源:ChannelSftp.cs

示例4: _get


//.........这里部分代码省略.........
				{
					while (rq.Count() < request_max)
					{
						SendREAD(handle, request_offset, request_len, rq);
						request_offset += request_len;
					}
					header = Header(buf, header);
					length = header.length;
					type = header.type;
					ChannelSftp.RequestQueue.Request rr = rq.Get(header.rid);
					if (type == SSH_FXP_STATUS)
					{
						Fill(buf, length);
						int i = buf.GetInt();
						if (i == SSH_FX_EOF)
						{
							goto loop_break;
						}
						ThrowStatusError(buf, i);
					}
					if (type != SSH_FXP_DATA)
					{
						goto loop_break;
					}
					buf.Rewind();
					Fill(buf.buffer, 0, 4);
					length -= 4;
					int length_of_data = buf.GetInt();
					// length of data 
					int optional_data = length - length_of_data;
					int foo = length_of_data;
					while (foo > 0)
					{
						int bar = foo;
						if (bar > buf.buffer.Length)
						{
							bar = buf.buffer.Length;
						}
						int data_len = io_in.Read(buf.buffer, 0, bar);
						if (data_len < 0)
						{
							goto loop_break;
						}
						dst.Write(buf.buffer, 0, data_len);
						offset += data_len;
						foo -= data_len;
						if (monitor != null)
						{
							if (!monitor.Count(data_len))
							{
								Skip(foo);
								if (optional_data > 0)
								{
									Skip(optional_data);
								}
								goto loop_break;
							}
						}
					}
					//System.err.println("length: "+length);  // length should be 0
					if (optional_data > 0)
					{
						Skip(optional_data);
					}
					if (length_of_data < rr.length)
					{
						//
						rq.Cancel(header, buf);
						SendREAD(handle, rr.offset + length_of_data, (int)(rr.length - length_of_data), rq
							);
						request_offset = rr.offset + rr.length;
					}
					if (request_max < rq.Size())
					{
						request_max++;
					}
loop_continue: ;
				}
loop_break: ;
				dst.Flush();
				if (monitor != null)
				{
					monitor.End();
				}
				rq.Cancel(header, buf);
				_sendCLOSE(handle, header);
			}
			catch (Exception e)
			{
				if (e is SftpException)
				{
					throw (SftpException)e;
				}
				if (e is Exception)
				{
					throw new SftpException(SSH_FX_FAILURE, string.Empty, (Exception)e);
				}
				throw new SftpException(SSH_FX_FAILURE, string.Empty);
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:101,代码来源:ChannelSftp.cs


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