Exemplo n.º 1
0
        public virtual InputStream getExtInputStream()
        {
            PipedInputStream In =
                new MyPipedInputStream(
                    32 * 1024 // this value should be customizable.
                    );

            io.setExtOutputStream(new PassiveOutputStream(In), false);
            return(In);
        }
Exemplo n.º 2
0
        public virtual System.IO.StreamReader GetReader()
        {
            if (pipeIn == null)
            {
                pipeInStream  = new MyPipedInputStream();
                pipeOutStream = new System.IO.StreamWriter(pipeInStream.BaseStream);
                pipeIn        = new System.IO.StreamReader(pipeInStream.BaseStream, System.Text.Encoding.GetEncoding("UTF-16BE"));
                pipeOut       = new System.IO.StreamWriter(pipeOutStream.BaseStream, System.Text.Encoding.GetEncoding("UTF-16BE"));

                SupportClass.ThreadClass thread = new ParserThread(this);
                thread.Start();                 // start parsing
            }

            return(pipeIn);
        }
Exemplo n.º 3
0
        public virtual System.IO.StreamReader GetReader()
        {
            if (pipeIn == null)
            {
                pipeInStream = new MyPipedInputStream(this, new System.IO.StreamReader(new System.IO.MemoryStream(1024)));
                pipeOutStream = new System.IO.StreamWriter(pipeInStream.BaseStream);
                pipeIn = new System.IO.StreamReader(pipeInStream.BaseStream, System.Text.Encoding.Default);
                pipeOut = new System.IO.StreamWriter(pipeOutStream.BaseStream, System.Text.Encoding.Default);
				
                SupportClass.ThreadClass thread = new ParserThread(this);
                thread.Start(); // start parsing
            }
			
            return pipeIn;
        }
Exemplo n.º 4
0
		public virtual java.io.InputStream getExtInputStream()  
		{
			PipedInputStream In=
				new MyPipedInputStream(
				32*1024  // this value should be customizable.
				);
			io.setExtOutputStream(new PassiveOutputStream(In), false);
			return In;
		}
Exemplo n.º 5
0
		public virtual System.IO.StreamReader GetReader()
		{
			if (pipeIn == null)
			{
				pipeInStream = new MyPipedInputStream();
				pipeOutStream = new System.IO.StreamWriter(pipeInStream.BaseStream);
				pipeIn = new System.IO.StreamReader(pipeInStream.BaseStream, System.Text.Encoding.GetEncoding("UTF-16BE"));
				pipeOut = new System.IO.StreamWriter(pipeOutStream.BaseStream, System.Text.Encoding.GetEncoding("UTF-16BE"));
				
				ThreadClass thread = new ParserThread(this);
				thread.Start(); // start parsing
			}
			
			return pipeIn;
		}
Exemplo n.º 6
0
		public override void start() 
		{ //throws JSchException{
			try
			{

				PipedOutputStream pos=new PipedOutputStream();
				io.setOutputStream(pos);
				PipedInputStream pis=new MyPipedInputStream(pos, 32*1024);
				io.setInputStream(pis);

				Request request=new RequestSftp();
				request.request(session, this);

				/*
					  System.err.println("lmpsize: "+lmpsize);
					  System.err.println("lwsize: "+lwsize);
					  System.err.println("rmpsize: "+rmpsize);
					  System.err.println("rwsize: "+rwsize);
				*/

				buf=new Buffer(rmpsize);
				packet=new Packet(buf);
				int i=0;
				int length;
				int type;
				byte[] str;

				// send SSH_FXP_INIT
				sendINIT();

				// receive SSH_FXP_VERSION
				Header _header=new Header();
				_header=header(buf, _header);
				length=_header.length;
				if(length > MAX_MSG_LENGTH)
				{
					throw new SftpException(SSH_FX_FAILURE, "Received message is too long: " + length);
				}
				type=_header.type;             // 2 -> SSH_FXP_VERSION
				server_version=_header.rid;
				skip(length);
				//System.err.println("SFTP protocol server-version="+server_version);
				//System.Console.WriteLine("server_version="+server_version+", type="+type+", length="+length+", i="+i);
				
				// send SSH_FXP_REALPATH
				sendREALPATH(new String(".").getBytes());

				// receive SSH_FXP_NAME
				_header=header(buf, _header);
				length=_header.length;
				type=_header.type;            // 104 -> SSH_FXP_NAME
				buf.rewind();
				fill(buf.buffer, 0, length);
				i=buf.getInt();              // count
				//System.Console.WriteLine("type="+type+", length="+length+", i="+i);
				str=buf.getString();         // filename
				//System.Console.WriteLine("str.length="+str.Length);
				home=cwd=new String(str);
				str=buf.getString();         // logname
				//    SftpATTRS.getATTR(buf);      // attrs

				lcwd=new File(".").getCanonicalPath();
			}
			catch(Exception e)
			{
				//System.out.println(e);
				//System.Console.WriteLine(e);
				if(e is JSchException) throw (JSchException)e;
				throw new JSchException(e.toString());
			}
		}
Exemplo n.º 7
0
		public override void start() 
		{
			try
			{
				PipedOutputStream pos=new PipedOutputStream();
				io.setOutputStream(pos);
				//      PipedInputStream pis=new PipedInputStream(pos);
				PipedInputStream pis=new MyPipedInputStream(pos, 32*1024);
				io.setInputStream(pis);

				Request request=new RequestSftp();
				request.request(session, this);

				//    thread=Thread.currentThread();

				//      buf=new Buffer();
				buf=new Buffer(rmpsize);
				packet=new Packet(buf);
				int i=0;
				int j=0;
				int length;
				int type;
				byte[] str;

				// send SSH_FXP_INIT
				sendINIT();

				// receive SSH_FXP_VERSION
				buf.rewind();
				i=io.ins.Read(buf.buffer, 0, buf.buffer.Length);
				//System.out.println(io+" "+io.ins+" "+io.out);
				length=buf.getInt();
				type=buf.getByte();           // 2 -> SSH_FXP_VERSION
				server_version=buf.getInt();
				//System.out.println("SFTP protocol server-version="+server_version);

				// send SSH_FXP_REALPATH
				sendREALPATH(Util.getBytes("."));

				// receive SSH_FXP_NAME
				buf.rewind();
				i=io.ins.Read(buf.buffer, 0, buf.buffer.Length);
				length=buf.getInt();
				type=buf.getByte();          // 104 -> SSH_FXP_NAME
				buf.getInt();                //
				i=buf.getInt();              // count
				str=buf.getString();         // filename
				home=cwd=Util.getString(str);
				str=buf.getString();         // logname
				//    SftpATTRS.getATTR(buf);           // attrs

				lcwd=Path.GetFullPath(".");

				//thread=new Thread(this);
				//thread.setName("Sftp for "+session.host);
				//thread.start();
			}
			catch(Exception e)
			{
				//System.out.println(e);
				if(e is JSchException) throw (JSchException)e;
				throw new JSchException(e.ToString());
			}
		}
Exemplo n.º 8
0
        public override void start()
        { //throws JSchException{
            try
            {
                PipedOutputStream pos = new PipedOutputStream();
                io.setOutputStream(pos);
                PipedInputStream pis = new MyPipedInputStream(pos, 32 * 1024);
                io.setInputStream(pis);

                Request request = new RequestSftp();
                request.request(session, this);

                /*
                 *    System.err.println("lmpsize: "+lmpsize);
                 *    System.err.println("lwsize: "+lwsize);
                 *    System.err.println("rmpsize: "+rmpsize);
                 *    System.err.println("rwsize: "+rwsize);
                 */

                buf    = new Buffer(rmpsize);
                packet = new Packet(buf);
                int    i = 0;
                int    length;
                int    type;
                byte[] str;

                // send SSH_FXP_INIT
                sendINIT();

                // receive SSH_FXP_VERSION
                Header _header = new Header();
                _header = ReadHeader(buf, _header);
                length  = _header.length;
                if (length > MAX_MSG_LENGTH)
                {
                    throw new SftpException(SSH_FX_FAILURE, "Received message is too long: " + length);
                }
                type          = _header.type;    // 2 -> SSH_FXP_VERSION
                ServerVersion = _header.rid;
                skip(length);
                //System.err.println("SFTP protocol server-version="+server_version);
                //System.Console.WriteLine("server_version="+server_version+", type="+type+", length="+length+", i="+i);

                // send SSH_FXP_REALPATH
                sendREALPATH(".");

                // receive SSH_FXP_NAME
                _header = ReadHeader(buf, _header);
                length  = _header.length;
                type    = _header.type;         // 104 -> SSH_FXP_NAME
                buf.Rewind();
                fill(buf.buffer, 0, length);
                i = buf.ReadInt();              // count
                //System.Console.WriteLine("type="+type+", length="+length+", i="+i);
                str = buf.ReadString();         // filename
                //System.Console.WriteLine("str.length="+str.Length);
                home = cwd = Encoding.UTF8.GetString(str);
                str  = buf.ReadString();        // logname
                //    SftpATTRS.getATTR(buf);      // attrs

                lcwd = System.IO.Path.GetFullPath(".");
            }
            catch (Exception e)
            {
                //System.out.println(e);
                //System.Console.WriteLine(e);
                if (e is JSchException)
                {
                    throw (JSchException)e;
                }
                throw new JSchException(e.ToString());
            }
        }
Exemplo n.º 9
0
        public override void start()
        {
            try
            {
                PipedOutputStream pos = new PipedOutputStream();

                io.setOutputStream(pos);

                PipedInputStream pis = new MyPipedInputStream(pos, 32 * 1024);

                io.setInputStream(pis);

                Request request = new RequestSftp();
                request.request(session, this);

                buf = new Buffer(rmpsize);
                packet = new Packet(buf);
                int i = 0;
                int length;
                int type;
                byte[] str;

                // send SSH_FXP_INIT
                sendINIT();

                // receive SSH_FXP_VERSION
                Header _header = new Header();
                _header = header(buf, _header);
                length = _header.length;

                if (length > MAX_MSG_LENGTH)
                {
                    throw new SftpException(SSH_FX_FAILURE, "Received message is too long: " + length);
                }

                type = _header.type; // 2 -> SSH_FXP_VERSION
                server_version = _header.rid;
                skip(length);

                // send SSH_FXP_REALPATH
                sendREALPATH(".".GetBytes());

                // receive SSH_FXP_NAME
                _header = header(buf, _header);
                length = _header.length;
                type = _header.type; // 104 -> SSH_FXP_NAME
                buf.rewind();
                fill(buf.buffer, 0, length);
                i = buf.getInt(); // count
                str = buf.getString(); // filename
                home = cwd = new JavaString(str);
                str = buf.getString(); // logname

                lcwd = new File(".").getCanonicalPath();
            }
            catch (Exception e)
            {
                if (e is JSchException) throw (JSchException)e;
                throw new JSchException(e);
            }
        }