A
download ChannelSftpStreamPut.cs
Language: C#
LOC: 57
Project Info
labmanager - A C# application for administ...bs...(labmanager)
Server: Google
Type: svn
...er\trunk\lib\SharpSSH\jsch\
   Buffer.cs
   Channel.cs
   Channel.old.cs
   ChannelDirectTCPIP.cs
   ChannelExec.cs
   ChannelForwardedTCPIP.cs
   ChannelSession.cs
   ChannelSftp.cs
   ChannelSftpOld.cs
   ChannelSftpStreamGet.cs
   ChannelSftpStreamPut.cs
   ChannelShell.cs
   ChannelSubsystem.cs
   ChannelX11.cs
   Cipher.cs
   Compression.cs
   DH.cs
   DHG1.cs
   DHGEX.cs
   ForwardedTCPIPDaemon.cs
   HASH.cs
   HostKey.cs
   HostKeyRepository.cs
   Identity.cs
   IdentityFile.cs
   IO.cs
   JSch.cs
   JSchAuthCancelException.cs
   JSchException.cs
   ...PartialAuthException.cs
   KeyExchange.cs
   KeyPair.cs
   KeyPairDSA.cs
   KeyPairGenDSA.cs
   KeyPairGenRSA.cs
   KeyPairRSA.cs
   KnownHosts.cs
   MAC.cs
   Packet.cs
   PortWatcher.cs
   Proxy.cs
   Random.cs
   Request.cs
   RequestExec.cs
   RequestPtyReq.cs
   RequestSftp.cs
   RequestShell.cs
   RequestSignal.cs
   RequestSubsystem.cs
   RequestWindowChange.cs
   RequestX11.cs
   ServerSocketFactory.cs
   Session.cs
   Session.old.cs
   SftpATTRS.cs
   SftpException.cs
   SftpProgressMonitor.cs
   SignatureDSA.cs
   SignatureRSA.cs
   SocketFactory.cs
   UIKeyboardInteractive.cs
   UserAuth.cs
   ...hKeyboardInteractive.cs
   UserAuthNone.cs
   UserAuthPassword.cs
   UserAuthPublicKey.cs
   UserInfo.cs
   Util.cs

using System;
using System.IO;

namespace Tamir.SharpSsh.jsch
{
	internal class OutputStreamPut : java.io.OutputStream
	{
		ChannelSftp sftp;
		byte[] handle;
		long[] _offset;
		SftpProgressMonitor monitor;
	
		internal OutputStreamPut
			(ChannelSftp sftp,
			byte[] handle,
			long[] _offset,
			SftpProgressMonitor monitor):base()
		{
			this.sftp=sftp;
			this.handle=handle;
			this._offset=_offset;
			this.monitor=monitor;
		}
	
		public override void Write(byte[] d, int s, int len) 
		{
			try
			{
				int _len=len;
				while(_len>0)
				{
					_len-=sftp.sendWRITE(handle, _offset[0], d, s, _len);
				}
				_offset[0]+=len;
				//            if(!checkStatus()){ 
				//              throw new IOException("jsch status error");
				//            }
				if(monitor!=null && !monitor.count(len))
				{
					throw new IOException("canceled");
				}
			}
			catch(IOException e){ throw e; }
			catch(Exception e){ throw new IOException(e.ToString());  }
		}
		byte[] _data=new byte[1];
		public void write(int foo) 
		{
			_data[0]=(byte)foo;
			Write(_data, 0, 1);
		}
		public override void Close() 
		{
			if(monitor!=null)monitor.end();
			try{ sftp._sendCLOSE(handle); }
			catch(IOException e){ throw e; }
			catch(Exception e)
			{
				throw new IOException(e.ToString());
			}
		}
	}
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us