Package com.sshtools.j2ssh.io

Examples of com.sshtools.j2ssh.io.ByteArrayWriter.writeString()


        throws IOException {
        log.debug("Requesting environment variable to be set [" + name + "=" +
            value + "]");

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(name);
        baw.writeString(value);

        return connection.sendChannelRequest(this, "env", true,
            baw.toByteArray());
    }
View Full Code Here


        log.debug("Requesting environment variable to be set [" + name + "=" +
            value + "]");

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(name);
        baw.writeString(value);

        return connection.sendChannelRequest(this, "env", true,
            baw.toByteArray());
    }
View Full Code Here

        log.debug("Requesting X11 forwarding for display " + display +
            " using cookie " + cookie);

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeBoolean(false);
        baw.writeString("MIT-MAGIC-COOKIE-1");
        baw.writeString(cookie);
        baw.writeUINT32(new UnsignedInteger32(String.valueOf(display)));

        return connection.sendChannelRequest(this, "x11-req", true,
            baw.toByteArray());
View Full Code Here

            " using cookie " + cookie);

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeBoolean(false);
        baw.writeString("MIT-MAGIC-COOKIE-1");
        baw.writeString(cookie);
        baw.writeUINT32(new UnsignedInteger32(String.valueOf(display)));

        return connection.sendChannelRequest(this, "x11-req", true,
            baw.toByteArray());
    }
View Full Code Here

    public boolean executeCommand(String command) throws IOException {
        log.info("Requesting command execution");
        log.info("Command is " + command);

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(command);

        if( connection.sendChannelRequest(this, "exec", true, baw.toByteArray()) )
        {
          if (sessionType.equals("Uninitialized")) {
            sessionType = command;
View Full Code Here

            log.debug("Height=" + String.valueOf(height));
        }

        // This requests a pseudo terminal
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(term);
        baw.writeInt(cols);
        baw.writeInt(rows);
        baw.writeInt(width);
        baw.writeInt(height);
        baw.writeString(terminalModes);
View Full Code Here

        baw.writeString(term);
        baw.writeInt(cols);
        baw.writeInt(rows);
        baw.writeInt(width);
        baw.writeInt(height);
        baw.writeString(terminalModes);

        return connection.sendChannelRequest(this, "pty-req", true,
            baw.toByteArray());
    }
View Full Code Here

     */
    public boolean startSubsystem(String subsystem) throws IOException {
        log.info("Starting " + subsystem + " subsystem");

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(subsystem);

        if (connection.sendChannelRequest(this, "subsystem", true,
                    baw.toByteArray())) {
            if (sessionType.equals("Uninitialized")) {
                sessionType = subsystem;
View Full Code Here

            throw new ForwardingConfigurationException(
                "X11 forwarding hasn't been enabled.");
        }

        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(x11ForwardingConfiguration.getAddressToBind());
        baw.writeInt(x11ForwardingConfiguration.getPortToBind());
        x11ForwardingConfiguration.getState().setValue(StartStopState.STARTED);

        if (log.isDebugEnabled()) {
            log.info("X11 forwarding started");
View Full Code Here

                "The name is not a valid forwarding configuration");
        }

        ForwardingConfiguration config = (ForwardingConfiguration) remoteForwardings.get(name);
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString(config.getAddressToBind());
        baw.writeInt(config.getPortToBind());
        connection.sendGlobalRequest(REMOTE_FORWARD_REQUEST, true,
            baw.toByteArray());
        remoteForwardings.put(name, config);
        config.getState().setValue(StartStopState.STARTED);
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.