14fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy/*
24fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * Licensed to the Apache Software Foundation (ASF) under one or more
34fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * contributor license agreements.  See the NOTICE file distributed with
44fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * this work for additional information regarding copyright ownership.
54fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * The ASF licenses this file to You under the Apache License, Version 2.0
64fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * (the "License"); you may not use this file except in compliance with
74fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * the License.  You may obtain a copy of the License at
84fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *
94fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *      http://www.apache.org/licenses/LICENSE-2.0
104fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *
114fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * Unless required by applicable law or agreed to in writing, software
124fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * distributed under the License is distributed on an "AS IS" BASIS,
134fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * See the License for the specific language governing permissions and
154fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * limitations under the License.
164fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy */
174fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedypackage org.apache.commons.io.output;
184fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
194fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedyimport java.io.Writer;
204fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
214fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy/**
224fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * This {@link Writer} writes all data to the famous <b>/dev/null</b>.
234fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * <p>
244fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * This <code>Writer</code> has no destination (file/socket etc.) and all
254fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * characters written to it are ignored and lost.
264fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy *
274fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy * @version $Id: NullWriter.java 610010 2008-01-08 14:50:59Z niallp $
284fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy */
294fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedypublic class NullWriter extends Writer {
304fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
314fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
324fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * A singleton.
334fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
344fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public static final NullWriter NULL_WRITER = new NullWriter();
354fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
364fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
374fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Constructs a new NullWriter.
384fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
394fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public NullWriter() {
404fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
414fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
424fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
434fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Does nothing - output to <code>/dev/null</code>.
444fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param idx The character to write
454fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
464fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void write(int idx) {
474fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
484fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
494fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
504fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
514fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Does nothing - output to <code>/dev/null</code>.
524fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param chr The characters to write
534fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
544fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void write(char[] chr) {
554fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
564fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
574fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
584fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
594fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Does nothing - output to <code>/dev/null</code>.
604fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param chr The characters to write
614fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param st The start offset
624fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param end The number of characters to write
634fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
644fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void write(char[] chr, int st, int end) {
654fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
664fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
674fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
684fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
694fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Does nothing - output to <code>/dev/null</code>.
704fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param str The string to write
714fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
724fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void write(String str) {
734fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
744fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
754fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
764fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /**
774fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * Does nothing - output to <code>/dev/null</code>.
784fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param str The string to write
794fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param st The start offset
804fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     * @param end The number of characters to write
814fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy     */
824fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void write(String str, int st, int end) {
834fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
844fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
854fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
864fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /** @see java.io.Writer#flush() */
874fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void flush() {
884fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
894fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
904fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
914fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    /** @see java.io.Writer#close() */
924fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    public void close() {
934fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy        //to /dev/null
944fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy    }
954fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy
964fa0a3295bcacbdcd6a9e7709cf17aa5adb90356Scott Kennedy}
97