Re: System.out & ByteArrayOutputStream
Re: System.out & ByteArrayOutputStream
- Subject: Re: System.out & ByteArrayOutputStream
- From: Owen Jones <email@hidden>
- Date: Wed, 10 Nov 2004 14:38:55 -0500
- Organization: York University
Nathan;
Subclass ByteArrayOutputStream and override the write() methods (there are two).
e.g. (partial, not tested):
class myByteArrayOutputStream extends ByteArrayOutputStream {
...
public void write(int b) {
super.write(b);
// do my stuff
}
...
}
Add callbacks if you need to.
Nathan Dumar wrote:
I'm reading the docs but coming up short. I want to send an email when
I get a message posted to System.out or System.err. So far, I have ...
// none of this has been tested yet
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
System.setOut(ps);
System.setErr(ps);
I can do baos.toString() to get the String I need for the body of the
email. The problem is that when my ByteArrayOutputStream baos gets
written to, I need to do stuff, then send the email.
I can't figure out a way to set off another method after baos gets
data. Any ideas?
Thank you,
Nathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Regards, Owen Jones
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d+ s+:+ a+ C+ UL P+ L++ E W++ N++ o-- K- w
O-- M- V-- PS+ PE Y+ PGP- t 5++ X R !tv b DI+ D++
G e++ h+ r--- y+
------END GEEK CODE BLOCK------
----------- SETI@Home Stats: 10561WU/12.16yrs -----------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden