简体   繁体   中英

Use System.out printout as input for another program (Java)

A simple scenario here,

I have a thread (let's call it A ) that writes to terminal indefinitely(using System.out ) I need to somehow retrieve those information from another Thread (let's call it B ). The problem is that A and B cannot communicate in any other way.

So is there a way that B can retrieve those information from terminal?

Note: This is a prototype I'm designing. thread A can be any other process and not necessarily written in Java, it just runs on a terminal indefinately

You could just create a class that can hold all the required informations for the threads. Or use a File and just place everything in there (like a "simulated console"), but that's rather ugly than anything else if you ask me..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM