Package org.apache.sshd.common.util

Examples of org.apache.sshd.common.util.Buffer$BufferException


        buffer.putString(path);
        return checkOneName(receive(send(SSH_FXP_READLINK, buffer)));
    }

    public void symLink(String linkPath, String targetPath) throws IOException {
        Buffer buffer = new Buffer();
        buffer.putString(linkPath);
        buffer.putString(targetPath);
        checkStatus(receive(send(SSH_FXP_RENAME, buffer)));
    }
View Full Code Here


        if (closed) {
            throw new SshException("Already closed");
        }
        try {
            while (bufferLength > 0) {
                Buffer buf = buffer;
                int total = bufferLength;
                int length = Math.min(Math.min(remoteWindow.waitForSpace(), total), remoteWindow.getPacketSize());
                int pos = buf.wpos();
                buf.wpos(cmd == SshConstants.Message.SSH_MSG_CHANNEL_EXTENDED_DATA ? 14 : 10);
                buf.putInt(length);
                buf.wpos(buf.wpos() + length);
                if (total == length) {
                    newBuffer(length);
                } else {
                    int leftover = total - length;
                    newBuffer(Math.max(leftover, length));
                    buffer.putRawBytes(buf.array(), pos - leftover, leftover);
                    bufferLength = leftover;
                }
                lastSize = length;
                remoteWindow.waitAndConsume(length);
                log.debug("Send {} on channel {}", cmd, channel.getId());
View Full Code Here

            } else {
                log.debug("Closing channel {} gracefully", id);
                preClose(immediately).addListener(new SshFutureListener<CloseFuture>() {
                    public void operationComplete(CloseFuture future) {
                        log.debug("Send SSH_MSG_CHANNEL_CLOSE on channel {}", id);
                        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_CLOSE, 0);
                        buffer.putInt(recipient);
                        try {
                            session.writePacket(buffer).addListener(new SshFutureListener<IoWriteFuture>() {
                                public void operationComplete(IoWriteFuture future) {
                                    if (closedByOtherSide) {
                                        log.debug("Message SSH_MSG_CHANNEL_CLOSE written on channel {}", id);
View Full Code Here

    protected abstract void doWriteExtendedData(byte[] data, int off, int len) throws IOException;

    protected void sendEof() throws IOException {
        log.debug("Send SSH_MSG_CHANNEL_EOF on channel {}", id);
        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_EOF, 0);
        buffer.putInt(recipient);
        writePacket(buffer);
    }
View Full Code Here

        localWindow.init(window, packet);
    }

    protected void sendWindowAdjust(int len) throws IOException {
        log.debug("Send SSH_MSG_CHANNEL_WINDOW_ADJUST on channel {}", id);
        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_WINDOW_ADJUST, 0);
        buffer.putInt(recipient);
        buffer.putInt(len);
        writePacket(buffer);
    }
View Full Code Here

                    reply = sftpLet.afterCommand(SftpSubsystem.this, request, reply);
                    if (reply != null) {
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("Sending sftp reply: " + reply);
                        }
                        Buffer buffer = serializer.writeReply(reply);
                        send(buffer);
                    }
                } catch (Throwable t) {
                    // TODO do something
                    t.printStackTrace();
View Full Code Here

    private Buffer writeAttrsReply(SshFxpAttrsReply reply) throws IOException {
        int id = reply.getId();
        FileAttributes attrs = reply.getAttributes();

        Buffer buffer = new Buffer();
        buffer.putByte((byte) SSH_FXP_ATTRS);
        buffer.putInt(id);
        writeAttrs(buffer, attrs);
        return buffer;
    }
View Full Code Here

    }

    private Buffer writeVersionReply(SshFxpVersionReply reply) {
        int version = reply.getVersion();

        Buffer buffer = new Buffer();
        buffer.putByte((byte) SSH_FXP_VERSION);
        buffer.putInt(version);
        return buffer;
    }
View Full Code Here

    }

    private Buffer writeNameReply(SshFxpNameReply reply) {
        int id = reply.getId();
        Collection<SshFxpNameReply.ReplyFile> files = reply.getFiles();
        Buffer buffer = new Buffer();
        buffer.putByte((byte) SSH_FXP_NAME);
        buffer.putInt(id);
        buffer.putInt(files.size());
        for (SshFxpNameReply.ReplyFile f : files) {
            buffer.putString(f.getFileName());
            if (session.getVersion() <= 3) {
                buffer.putString(f.getLongName()); // Format specified in the specs
            }
            writeAttrs(buffer, f.getAttrs());
        }
        if (session.getVersion() >= 6 && reply.isEol()) {
            buffer.putBoolean(true);
        }
        return buffer;
    }
View Full Code Here

    private Buffer writeHandleReply(SshFxpHandleReply reply) throws IOException {
        int id = reply.getId();
        String handle = reply.getHandle().getId();

        Buffer buffer = new Buffer();
        buffer.putByte((byte) SSH_FXP_HANDLE);
        buffer.putInt(id);
        buffer.putString(handle);
        return buffer;
    }
View Full Code Here

TOP

Related Classes of org.apache.sshd.common.util.Buffer$BufferException

Copyright © 2018 www.massapicom. 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.