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


C# OutputStream.write方法代码示例

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


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

示例1: _get

		///tamir: updated to jcsh-0.1.30
		private void _get(String src, OutputStream dst,
			SftpProgressMonitor monitor, int mode, long skip) 
		{ //throws SftpException{
			//System.out.println("_get: "+src+", "+dst);
			//try
			//{
				sendOPENR(src.getBytes());
				
				
				Header _header=new Header();
				_header=header(buf, _header);
				int length=_header.length;
				int type=_header.type;
				
				buf.rewind();
				
				fill(buf.buffer, 0, length);

				if(type!=SSH_FXP_STATUS && type!=SSH_FXP_HANDLE)
				{
					//System.Console.WriteLine("Type is "+type);
					throw new SftpException(SSH_FX_FAILURE, "Type is "+type);
				}

				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, 
//.........这里部分代码省略.........
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:101,代码来源:ChannelSftp.cs

示例2: execGet

        private void execGet(string src, OutputStream dst, SftpProgressMonitor monitor, ChannelSftpModes mode, long skip)
        {
            try
            {
                sendOPENR(Util.getBytesUTF8(src));

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

                m_buffer.rewind();

                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:
//.........这里部分代码省略.........
开发者ID:x893,项目名称:SharpSSH,代码行数:101,代码来源:ChannelSftp.cs

示例3: writeTo

 /// <summary>
 /// Writes the complete contents of this byte array output stream to
 /// the specified output stream argument, as if by calling the output
 /// stream's write method using <code>out.write(buf, 0, count)</code>.
 /// </summary>
 /// <remarks>
 /// Writes the complete contents of this byte array output stream to
 /// the specified output stream argument, as if by calling the output
 /// stream's write method using <code>out.write(buf, 0, count)</code>.
 /// </remarks>
 /// <param name="out">the output stream to which to write the data.</param>
 /// <exception>
 /// IOException
 /// if an I/O error occurs.
 /// </exception>
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void writeTo(OutputStream @out)
 {
     lock (this)
     {
         @out.write(buf, 0, count);
     }
 }
开发者ID:sangnvus,项目名称:technical-docs,代码行数:23,代码来源:ByteArrayOutputStream.cs

示例4: bitcoinSerializeToStream

		//@Override
		//throws IOException
		protected void bitcoinSerializeToStream(OutputStream stream)
		{
			uint32ToByteStreamLE(version, stream);
			stream.write(new VarInt(inputs.size()).encode());
			foreach(TransactionInput input in inputs)
			{ input.bitcoinSerialize(stream); }
			stream.write(new VarInt(outputs.size()).encode());
			foreach(TransactionOutput output in outputs)
			{ output.bitcoinSerialize(stream); }
			uint32ToByteStreamLE(lockTime,stream);
		}
开发者ID:knocte,项目名称:BitcoinDotNet,代码行数:13,代码来源:Transaction.cs


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