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