All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.sshapi.impl.maverick.MaverickSshShell Maven / Gradle / Ivy

Go to download

Maverick is the definitive solution for total SSH compatibility on the Java™ platform. The library is designed to support SSH1 and SSH2 using any version of the Java Development Kit from 1.1 and above, and the API is also now J2ME-ready1 in anticipation of the new breed of interconnected mobile devices Downloads and more information about Maverick may be found at http://www.sshtools.co.uk/en/j2ssh-maverick/. This library is the provider bridge for SSHAPI.

The newest version!
/* 
 * Copyright (c) 2010 The JavaSSH Project
 * All rights reserved.
 * 
 * Permission is hereby granted, free  of charge, to any person obtaining
 * a  copy  of this  software  and  associated  documentation files  (the
 * "Software"), to  deal in  the Software without  restriction, including
 * without limitation  the rights to  use, copy, modify,  merge, publish,
 * distribute,  sublicense, and/or sell  copies of  the Software,  and to
 * permit persons to whom the Software  is furnished to do so, subject to
 * the following conditions:
 * 
 * The  above  copyright  notice  and  this permission  notice  shall  be
 * included in all copies or substantial portions of the Software.
 * 
 * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
 * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
 * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package net.sf.sshapi.impl.maverick;

import java.io.IOException;
import java.io.InputStream;

import com.sshtools.ssh.SshSession;

import net.sf.sshapi.SshException;
import net.sf.sshapi.SshShell;

class MaverickSshShell extends MaverickSshStreamChannel implements SshShell {

	MaverickSshShell(SshSession session) {
		super(session);
	}

	public InputStream getExtendedInputStream() throws IOException {
		return ((SshSession) getChannel()).getStderrInputStream();
	}

	public void onChannelOpen() throws SshException {
		try {
			if (!((SshSession) getChannel()).startShell()) {
				throw new SshException("Failed to start shell");
			}
		} catch (com.sshtools.ssh.SshException e) {
			throw new SshException("Failed to open shell.", e);
		}
	}

	public void requestPseudoTerminalChange(int width, int height, int pixw, int pixh) throws SshException {
		try {
			((SshSession) getChannel()).changeTerminalDimensions(width, height, pixw, pixw);
		} catch (com.sshtools.ssh.SshException e) {
			throw new SshException(SshException.GENERAL, e);
		}

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy