FileDocCategorySizeDatePackage
ReverseThread.javaAPI DocExample948Tue Dec 12 18:57:42 GMT 2000None

ReverseThread

public class ReverseThread extends Thread

Fields Summary
private PrintWriter
out
private BufferedReader
in
Constructors Summary
public ReverseThread(PrintWriter out, BufferedReader in)


         
        this.out = out;
        this.in = in;
    
Methods Summary
private java.lang.StringreverseIt(java.lang.String source)

        int i, len = source.length();
        StringBuffer dest = new StringBuffer(len);

        for (i = (len - 1); i >= 0; i--)
            dest.append(source.charAt(i));
        return dest.toString();
    
public voidrun()

        if (out != null && in != null) {
            try {
                String input;
                while ((input = in.readLine()) != null) {
                    out.println(reverseIt(input));
                    out.flush();
                }
                out.close();
            } catch (IOException e) {
                System.err.println("ReverseThread run: " + e);
            }
        }