console output writer?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

console output writer?

Karl Wettin
In my Java application I have:

  class App {
     void run() {
         while (...) {
           ...
           for (Listener listener : listeners) {
             listener.report(loginfo);
           }
         }
      }
      List<Listener> listeners;
   }

  class Listener {
     private Writer writer;

    Listener(Writer writer) {
       this.writer = writer;
     }

    void report(String report) throws IOException {
       writer.write(report);
       writer.write("\n");
     }
   }

I would like to telnet in and from from bsh:

   bsh % l = new Listener(console);
   bsh % app.listeners.add(l);

and now have evertying reported sent to my telnet console output. In  
order to make it stop I would have to

   bsh % app.listeners.remove(l);

How can I do this?

It is quite alright if it all get mixed up from listeners writing at  
the same time as I send commands, but if one can turn off echo and  
prompt, that would be great too.



karl

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