Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there any way to communicate between two classes within an application using InputStreams and OutputStreams?

0
Posted

Is there any way to communicate between two classes within an application using InputStreams and OutputStreams?

0

Location: http://www.jguru.com/faq/view.jsp?EID=54012 Created: May 22, 2000 Modified: 2000-05-23 18:28:32.671 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) Question originally posed by Sean Wiechman (http://www.jguru.com/guru/viewbio.jsp?EID=53867 The PipedInputStream/PipedReader and PipedOutputStream/PipedWriter streams provide synchronized I/O across threads, from within one class or multiple classes. The following example demonstrates their usage and was taken from my Mastering Java 2 book: import java.io.*; public class PipeTest { public static void main (String args[]) { new OilRefinery(); try { // delay arrival Thread.currentThread().sleep(500); } catch (InterruptedException e) { } new SuperTanker(); } // This class consists of a Thread that can accept “pipline” hook-ups // via the “clickClunk” method. Clients have to find us though from // our Thread name “ThePipeTerminal” static class OilRefinery extends Thread { static final int EOF = -1; boolean alone =

0

Location: http://www.jguru.com/faq/view.jsp?EID=54012 Created: May 22, 2000 Modified: 2000-05-23 18:28:32.671 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) Question originally posed by Sean Wiechman (http://www.jguru.com/guru/viewbio.jsp?EID=53867 The PipedInputStream/PipedReader and PipedOutputStream/PipedWriter streams provide synchronized I/O across threads, from within one class or multiple classes. The following example demonstrates their usage and was taken from my Mastering Java 2 book: import java.io.*; public class PipeTest { public static void main (String args[]) { new OilRefinery(); try { // delay arrival Thread.currentThread().sleep(500); } catch (InterruptedException e) { } new SuperTanker(); } // This class consists of a Thread that can accept “pipline” hook-ups // via the “clickClunk” method. Clients have to find us though from // our Thread name “ThePipeTerminal” static class OilRefinery extends Thread { static final int EOF = -1; boolean alone =

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.