Revision 477,
779 bytes
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[477] | 1 | package simulator.utils; |
---|
| 2 | |
---|
| 3 | import java.io.IOException; |
---|
| 4 | import java.io.OutputStream; |
---|
| 5 | |
---|
| 6 | import org.apache.commons.logging.Log; |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * |
---|
| 10 | * @author Marcin Krystek |
---|
| 11 | * |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | public class LogErrStream extends OutputStream { |
---|
| 15 | |
---|
| 16 | private Log log; |
---|
| 17 | |
---|
| 18 | public LogErrStream(Log log) { |
---|
| 19 | this.log = log; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | public void close() { |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | public void flush() { |
---|
| 26 | |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | public void write(final byte[] b) throws IOException { |
---|
| 30 | String s = new String(b); |
---|
| 31 | log.error(s); |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | public void write(final byte[] b, final int off, final int len) |
---|
| 35 | throws IOException { |
---|
| 36 | if(len == 1) |
---|
| 37 | return; |
---|
| 38 | |
---|
| 39 | String s = new String(b, off, len); |
---|
| 40 | log.error(s); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | public void write(final int b) throws IOException { |
---|
| 44 | log.error(b); |
---|
| 45 | } |
---|
| 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.