001    /*
002     * LAPIS lightweight structured text processing system
003     *
004     * Copyright (C) 1998-2002 Carnegie Mellon University,
005     * Copyright (C) 2003 Massachusetts Institute of Technology.
006     * All rights reserved.
007     *
008     * This library is free software; you can redistribute it
009     * and/or modify it under the terms of the GNU General
010     * Public License as published by the Free Software
011     * Foundation, version 2.
012     *
013     * LAPIS homepage: http://graphics.lcs.mit.edu/lapis/
014     */
015    package lapisx.io;
016    
017    import java.io.*;
018    
019    /**
020     * NullOutputStream is used when the OutuputStream interface is
021     * required, but when written bytes have no destination.  Note that
022     * this class is implemented using the Singleton pattern, and is
023     * accessed through the static <tt>getInstance()</tt> method.
024     *
025     */
026    public class NullOutputStream extends OutputStream {
027    
028        protected static final NullOutputStream instance = 
029            new NullOutputStream();
030    
031        protected NullOutputStream() { }
032    
033        public static NullOutputStream getInstance() {
034            return instance;
035        }
036    
037        public void write (int b) {
038            
039        }
040    
041        public void write (byte[] b, int off, int len) {
042    
043        }
044    
045        public void write (byte[] b) {
046    
047        }
048    }