I'm trying to build a class that I can use like the expect  command in tcl.  
I'm  having trouble  building  a  nonblocking  readline().  

I'm working with the example shell.java.  I have a good connection and I 
receive  no  errors.
 
            channel.connect();
            byte[] tmp=new byte[1024];
      while(true){
        while(in.available()>0){
          int i=in.read(tmp, 0, 1024);
          if(i<0)break;
          System.out.print(new String(tmp, 0, i));
        }
        if(channel.isClosed()){
          System.out.println("exit-status: "+channel.getExitStatus());
          break;
        }
        try{Thread.sleep(1000);}catch(Exception ee){}
      }

If I use BufferedReader, it blocks on the last line. I have no good way to test 
if the lastline has a \r.
If I use InputStream, I'm building readline from the ground up. I need to keep 
track of every char I read. 

Java Streams and channels are a weak spot for me.

Can a nonblocking readline be build into the channel class? 
What about a look ahead buffer?

Nicholas A. Schembri
State College PA USA
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to