01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.commons.io.output;
18:
19: import java.io.Writer;
20:
21: /**
22: * This {@link Writer} writes all data to the famous <b>/dev/null</b>.
23: * <p>
24: * This <code>Writer</code> has no destination (file/socket etc.) and all
25: * characters written to it are ignored and lost.
26: *
27: * @version $Id: NullWriter.java 462832 2006-10-11 15:48:09Z scolebourne $
28: */
29: public class NullWriter extends Writer {
30:
31: /**
32: * Constructs a new NullWriter.
33: */
34: public NullWriter() {
35: }
36:
37: /** @see java.io.Writer#write(int) */
38: public void write(int idx) {
39: //to /dev/null
40: }
41:
42: /** @see java.io.Writer#write(char[]) */
43: public void write(char[] chr) {
44: //to /dev/null
45: }
46:
47: /** @see java.io.Writer#write(char[], int, int) */
48: public void write(char[] chr, int st, int end) {
49: //to /dev/null
50: }
51:
52: /** @see java.io.Writer#write(String) */
53: public void write(String str) {
54: //to /dev/null
55: }
56:
57: /** @see java.io.Writer#write(String, int, int) */
58: public void write(String str, int st, int end) {
59: //to /dev/null
60: }
61:
62: /** @see java.io.Writer#flush() */
63: public void flush() {
64: //to /dev/null
65: }
66:
67: /** @see java.io.Writer#close() */
68: public void close() {
69: //to /dev/null
70: }
71:
72: }
|