Package org.foo.shell.tty

Source Code of org.foo.shell.tty.TtyBinding

package org.foo.shell.tty;

import java.io.*;

import org.foo.shell.Binding;
import org.foo.shell.Command;
import org.foo.shell.Shell;

public class TtyBinding implements Binding {
  private final Command m_command;
  private Shell shell;
  private Thread m_thread;

  public TtyBinding(Command command) {
    m_command = command;
  }

  public void start() {
    shell = new Shell(m_command, new BufferedReader(new InputStreamReader(System.in)),
        System.out, System.err);
    m_thread = new Thread(shell);
    m_thread.start();
  }

  public void stop() throws InterruptedException {
    m_thread.interrupt();
    shell = null;
  }
}
TOP

Related Classes of org.foo.shell.tty.TtyBinding

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.