KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > util > stream > NullOutputStream


1 /***************************************
2  * *
3  * JBoss: The OpenSource J2EE WebOS *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  ***************************************/

9
10 package org.jboss.util.stream;
11
12 import java.io.OutputStream JavaDoc;
13
14 /**
15  * A <tt>null</tt> <code>OutputStream</code>. All values passed to
16  * {@link #write(int)} are discarded. Calls to {@link #flush()} and
17  * {@link #close()} are ignored.
18  *
19  * <p>All methods are declared <b>NOT</b> to throw <code>IOException</code>s.
20  *
21  * @version <tt>$Revision: 1.1 $</tt>
22  * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a>
23  */

24 public final class NullOutputStream
25    extends OutputStream JavaDoc
26 {
27    /** A default null output stream. */
28    public static final NullOutputStream STREAM = new NullOutputStream();
29
30    /**
31     * Non-operation.
32     */

33    public void write(final int b) {}
34
35    /**
36     * Non-operation.
37     */

38    public void flush() {}
39
40    /**
41     * Non-operation.
42     */

43    public void close() {}
44
45    /**
46     * Non-operation.
47     */

48    public void write(final byte[] bytes) {}
49
50    /**
51     * Non-operation.
52     */

53    public void write(final byte[] bytes, final int offset, final int length) {}
54 }
55
Popular Tags