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


C# OutputStream.flush方法代码示例

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


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

示例1: _get


//.........这里部分代码省略.........
				}

				if(type==SSH_FXP_STATUS)
				{
					int i=buf.getInt();
					throwStatusError(buf, i);
				}
				
				byte[] handle=buf.getString();         // filename

				long offset=0;
				if(mode==RESUME)
				{
					offset+=skip;
				}

				int request_len=0;
			loop:
				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;
					
					int i;
					if(type==SSH_FXP_STATUS)
					{
						buf.rewind();
						fill(buf.buffer, 0, length);
						i=buf.getInt();   
						if(i==SSH_FX_EOF)
						{
							goto BREAK;
						}
						throwStatusError(buf, i);
					}
					
					if(type!=SSH_FXP_DATA)
					{
						goto BREAK;
					}

					buf.rewind();
					fill(buf.buffer, 0, 4); length-=4;
					i=buf.getInt();   // length of data 
					int foo=i;
					while(foo>0)
					{
						int bar=foo;
						if(bar>buf.buffer.Length)
						{
							bar=buf.buffer.Length;
						}
						i=io.ins.read(buf.buffer, 0, bar);
						if(i<0)
						{
							goto BREAK;
						}
						int data_len=i;
						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=io.ins.read(buf.buffer, 
										0, 
										(buf.buffer.Length<foo?buf.buffer.Length:foo));
									if(i<=0) break;
									foo-=i;
								}
								goto BREAK;
							}
						}
					}
					//System.out.println("length: "+length);  // length should be 0
				}
			BREAK:
				dst.flush();

				if(monitor!=null)monitor.end();
				_sendCLOSE(handle, _header);
			//}
			//catch(Exception e)
			//{
			//	//System.Console.WriteLine(e);
			//	if(e is SftpException) throw (SftpException)e;
			//	throw new SftpException(SSH_FX_FAILURE, "");
			//}
		}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:101,代码来源:ChannelSftp.cs

示例2: execGet


//.........这里部分代码省略.........
                fill(m_buffer.m_buffer, 0, length);

                if (type != SSH_FXP_STATUS && type != SSH_FXP_HANDLE)
                    throw new SftpException(ChannelSftpResult.SSH_FX_FAILURE, "Type is " + type);

                if (type == SSH_FXP_STATUS)
                {
                    int i = m_buffer.getInt();
                    throwStatusError(m_buffer, i);
                }

                byte[] handle = m_buffer.getString();         // filename

                long offset = 0;
                if (mode == ChannelSftpModes.RESUME)
                    offset += skip;

                int request_len = 0;

                while (true)
                {

                    request_len = m_buffer.m_buffer.Length - 13;
                    if (m_server_version == 0) { request_len = 1024; }
                    sendREAD(handle, offset, request_len);

                    header = fillHeader(m_buffer, header);
                    length = header.Length;
                    type = header.HeaderType;

                    int i;
                    if (type == SSH_FXP_STATUS)
                    {
                        m_buffer.rewind();
                        fill(m_buffer.m_buffer, 0, length);
                        i = m_buffer.getInt();
                        if (i == (int)ChannelSftpResult.SSH_FX_EOF)
                            goto BREAK;

                        throwStatusError(m_buffer, i);
                    }

                    if (type != SSH_FXP_DATA)
                        goto BREAK;

                    m_buffer.rewind();
                    fill(m_buffer.m_buffer, 0, 4); length -= 4;
                    i = m_buffer.getInt();   // length of data
                    int foo = i;
                    while (foo > 0)
                    {
                        int bar = foo;
                        if (bar > m_buffer.m_buffer.Length)
                        {
                            bar = m_buffer.m_buffer.Length;
                        }
                        i = m_io.m_ins.Read(m_buffer.m_buffer, 0, bar);
                        if (i < 0)
                        {
                            goto BREAK;
                        }
                        int data_len = i;
                        dst.write(m_buffer.m_buffer, 0, data_len);

                        offset += data_len;
                        foo -= data_len;

                        if (monitor != null)
                        {
                            if (!monitor.Count(data_len))
                            {
                                while (foo > 0)
                                {
                                    i = m_io.m_ins.Read(
                                            m_buffer.m_buffer,
                                            0,
                                            (m_buffer.m_buffer.Length < foo ? m_buffer.m_buffer.Length : foo)
                                        );
                                    if (i <= 0)
                                        break;
                                    foo -= i;
                                }
                                goto BREAK;
                            }
                        }
                    }
                }
            BREAK:
                dst.flush();

                if (monitor != null) monitor.End();
                sendCLOSE(handle, header);
            }
            catch (Exception e)
            {
                if (e is SftpException)
                    throw (SftpException)e;
                throw new SftpException(ChannelSftpResult.SSH_FX_FAILURE, "");
            }
        }
开发者ID:x893,项目名称:SharpSSH,代码行数:101,代码来源:ChannelSftp.cs


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