Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting Output from another Class's methods......
- From: biresh.kumar.basak@xxxxxxxx (Basak, Biresh Kumar)
- Subject: Getting Output from another Class's methods......
- Date: Tue, 29 Feb 2000 09:49:08 -0500
If you are using System.out.println(), then you should consider changing
those lines to stream variable based. It should be easy after that point.
class Class_One
{
private OutputStream out;
// Other members ...
public Class_One(OutputStream stream)
{
out = stream;
// ..rest of the stuff.
}
// Or .. have a separate method to setup the "out" variable.
public void setupOutputStream(OutputStream stream)
{
out = stream;
}
public void otherMethod()
{
// Before using the out variable to print anything,
// make sure it is setup properly.
if(out == null)
out = System.out; // In which case, probably its messages are not
// being captured by anybody.
// ... rest all lines.
}
Hope this helps.
-Biresh.
> -----Original Message-----
> From: sanjay.karanjkar@xxxxxxxxxxxxxxxx
[mailto:sanjay.karanjkar@xxxxxxxxxxxxxxxx]
> Sent: Monday, February 28, 2000 11:23 PM
> To: 'ADVANCED-JAVA'
> Subject: Getting Output from another Class's methods......
> Importance: High
>
> Hi,
> How to direct the output of methods from a class to another class?
For example, I have a class doing a fair bit of processing and printing
messages at many stages. I want to "trap" these messages into another
class......in other words, the OutputStream of the first class should be the
InputStream of the second......
>
> Any pointers on how to achieve the above?
>
> TIA,
> Sanjay Karanjkar
---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- Prev by Date: JNI char * in c -- to -- jcharArray to -- char[] in Java
- Next by Date: TSR in Java?
- Previous by thread: Getting Output from another Class's methods......
- Next by thread: Customized Mouse pointers and images
- Index(es):