Package org.apache.sshd.common.util

Examples of org.apache.sshd.common.util.Buffer.wpos()


  protected void pumpInputStream() {
    try {
      while (!closeFuture.isClosed()) {
        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_DATA, 0);
        buffer.putInt(recipient);
        int wpos1 = buffer.wpos(); // keep buffer position to write data length later
        buffer.putInt(0);
        int wpos2 = buffer.wpos(); // keep buffer position for data write
        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
View Full Code Here


      while (!closeFuture.isClosed()) {
        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_DATA, 0);
        buffer.putInt(recipient);
        int wpos1 = buffer.wpos(); // keep buffer position to write data length later
        buffer.putInt(0);
        int wpos2 = buffer.wpos(); // keep buffer position for data write
        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
          buffer.wpos(wpos1);
          buffer.putInt(len);
View Full Code Here

        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_DATA, 0);
        buffer.putInt(recipient);
        int wpos1 = buffer.wpos(); // keep buffer position to write data length later
        buffer.putInt(0);
        int wpos2 = buffer.wpos(); // keep buffer position for data write
        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
          buffer.wpos(wpos1);
          buffer.putInt(len);
          buffer.wpos(wpos2 + len);
View Full Code Here

        buffer.putInt(0);
        int wpos2 = buffer.wpos(); // keep buffer position for data write
        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
          buffer.wpos(wpos1);
          buffer.putInt(len);
          buffer.wpos(wpos2 + len);
          remoteWindow.waitAndConsume(len);
          log.debug("Send SSH_MSG_CHANNEL_DATA on channel {}", id);
          session.writePacket(buffer);
View Full Code Here

        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
          buffer.wpos(wpos1);
          buffer.putInt(len);
          buffer.wpos(wpos2 + len);
          remoteWindow.waitAndConsume(len);
          log.debug("Send SSH_MSG_CHANNEL_DATA on channel {}", id);
          session.writePacket(buffer);
        } else {
          // This is the bug fix we need!!
View Full Code Here

                }
                Buffer buffer = new Buffer(length + 4);
                buffer.putInt(length);
                int nb = length;
                while (nb > 0) {
                    int l = dis.read(buffer.array(), buffer.wpos(), nb);
                    if (l < 0) {
                        throw new IllegalArgumentException();
                    }
                    buffer.wpos(buffer.wpos() + l);
                    nb -= l;
View Full Code Here

                while (nb > 0) {
                    int l = dis.read(buffer.array(), buffer.wpos(), nb);
                    if (l < 0) {
                        throw new IllegalArgumentException();
                    }
                    buffer.wpos(buffer.wpos() + l);
                    nb -= l;
                }
                process(buffer);
            }
        } catch (Throwable t) {
View Full Code Here

                while (nb > 0) {
                    int l = dis.read(buffer.array(), buffer.wpos(), nb);
                    if (l < 0) {
                        throw new IllegalArgumentException();
                    }
                    buffer.wpos(buffer.wpos() + l);
                    nb -= l;
                }
                process(buffer);
            }
        } catch (Throwable t) {
View Full Code Here

    protected void sendName(int id, Iterator<SshFile> files) throws IOException {
        Buffer buffer = new Buffer();
        buffer.putByte((byte) SSH_FXP_NAME);
        buffer.putInt(id);
        int wpos = buffer.wpos();
        buffer.putInt(0);
        int nb = 0;
        while (files.hasNext() && buffer.wpos() < MAX_PACKET_LENGTH) {
            SshFile f = files.next();
            buffer.putString(f.getName());
View Full Code Here

        buffer.putByte((byte) SSH_FXP_NAME);
        buffer.putInt(id);
        int wpos = buffer.wpos();
        buffer.putInt(0);
        int nb = 0;
        while (files.hasNext() && buffer.wpos() < MAX_PACKET_LENGTH) {
            SshFile f = files.next();
            buffer.putString(f.getName());
            buffer.putString(getLongName(f)); // Format specified in the specs
            writeAttrs(buffer, f, false);
            nb++;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.