KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log4j > performance > NOPWriter


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.log4j.performance;
18
19 import java.io.Writer JavaDoc;
20 import java.io.IOException JavaDoc;
21
22 /**
23  * <p>Extends {@link Writer} with methods that return immediately
24  * without doing anything. This class is used to measure the cost of
25  * constructing a log message but not actually writing to any device.
26  * </p>
27
28  * <p><b> <font color="#FF2222">The
29  * <code>org.apache.log4j.performance.NOPWriter</code> class is
30  * intended for internal use only.</font> Consequently, it is not
31  * included in the <em>log4j.jar</em> file.</b> </p>
32  *
33  * @author Ceki G&uuml;lc&uuml;
34  * */

35 public class NOPWriter extends Writer JavaDoc {
36
37   public void write(char[] cbuf) throws IOException JavaDoc {}
38
39   public void write(char[] cbuf, int off, int len) throws IOException JavaDoc {}
40
41
42   public void write(int b) throws IOException JavaDoc {}
43
44   public void write(String JavaDoc s) throws IOException JavaDoc {}
45
46   public void write(String JavaDoc s, int off, int len) throws IOException JavaDoc {}
47
48   public void flush() throws IOException JavaDoc {
49   }
50
51   public void close() throws IOException JavaDoc {
52     System.err.println("Close called.");
53   }
54 }
55
Popular Tags