2 *******************************************************************************
\r
3 * Copyright (C) 2005-2008, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.dev.test;
\r
9 import java.io.IOException;
\r
10 import java.io.Writer;
\r
12 public final class TestLogWriter extends Writer {
\r
13 private TestLog log;
\r
15 private boolean closed;
\r
17 public TestLogWriter(TestLog log, int level) {
\r
22 public void write(char cbuf[], int off, int len) throws IOException {
\r
23 write(new String(cbuf, off, len));
\r
26 public void write(String str) throws IOException {
\r
28 throw new IOException("stream closed");
\r
30 if ("\r\n".indexOf(str) != -1) {
\r
31 log.msg("", level, level == TestLog.ERR, true);
\r
33 log.msg(str, level, level == TestLog.ERR, false);
\r
37 public void flush() throws IOException {
\r
40 public void close() throws IOException {
\r