commit e811551bfc002fb35a02a0e9c085b47e6e96bd4d from: leo date: Fri Feb 5 09:05:56 2010 UTC fixed waitfor for multi-byte commit - 1f5ced47512872225fbb20064195e3dc327a632f commit + e811551bfc002fb35a02a0e9c085b47e6e96bd4d blob - 7cc256d760ac95dbe2a325509f3dd3abacbf8b92 blob + aee478d2df5ce05c2e4bbfcb33bd83b7d64a5049 --- de/mud/jta/Wrapper.java +++ de/mud/jta/Wrapper.java @@ -25,18 +25,15 @@ package de.mud.jta; +import de.mud.telnet.ScriptHandler; + +import java.awt.*; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.io.IOException; import java.net.Socket; - import java.util.Vector; -import java.util.Properties; -import java.awt.Dimension; - -import de.mud.telnet.ScriptHandler; - /** * To write a program using the wrapper * you may use the following piece of code as an example: @@ -132,6 +129,7 @@ public class Wrapper { * a prompt is set it will return the resulting data until the prompt * is encountered. * @param cmd the command + * @throws IOException * @return output of the command or null if no prompt is set */ public String send(String cmd) throws IOException { return null; } @@ -141,7 +139,8 @@ public class Wrapper { * that characters that are received until that happens (including * the string being waited for). * - * @param match the string to look for + * @param searchElements the strings to look for + * @throws IOException if an io error occurs * @return skipped characters */ @@ -166,7 +165,7 @@ public class Wrapper { System.err.print( current ); ret.append( current ); for ( int i = 0; i < handlers.length ; i++ ) { - if ( handlers[i].match( ret.toString().getBytes(), ret.length() ) ) { + if ( handlers[i].match( ret.toString().getBytes(), ret.toString().getBytes().length ) ) { return ret.toString(); } // if } // for