204N/A/*
204N/A * CDDL HEADER START
204N/A *
204N/A * The contents of this file are subject to the terms of the
204N/A * Common Development and Distribution License, Version 1.0 only
204N/A * (the "License"). You may not use this file except in compliance
204N/A * with the License.
204N/A *
204N/A * You can obtain a copy of the license at
204N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
204N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
204N/A * See the License for the specific language governing permissions
204N/A * and limitations under the License.
204N/A *
204N/A * When distributing Covered Code, include this CDDL HEADER in each
204N/A * file and include the License file at
204N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
204N/A * add the following below this CDDL HEADER, with the fields enclosed
873N/A * by brackets "[]" replaced with your own identifying information:
204N/A * Portions Copyright [yyyy] [name of copyright owner]
204N/A *
204N/A * CDDL HEADER END
204N/A *
204N/A *
3215N/A * Copyright 2006-2008 Sun Microsystems, Inc.
204N/A */
204N/Apackage org.opends.server.types;
204N/A
204N/A
204N/A
204N/Aimport java.io.OutputStream;
204N/Aimport java.io.PrintStream;
204N/A
204N/A
204N/A
204N/A/**
204N/A * This class defines a custom output stream that simply discards any
204N/A * data written to it.
204N/A */
2095N/A@org.opends.server.types.PublicAPI(
2095N/A stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
2095N/A mayInstantiate=true,
2095N/A mayExtend=false,
2095N/A mayInvoke=true)
2095N/Apublic final class NullOutputStream
204N/A extends OutputStream
204N/A{
204N/A /**
204N/A * The singleton instance for this class.
204N/A */
204N/A private static final NullOutputStream instance =
204N/A new NullOutputStream();
204N/A
204N/A
204N/A
204N/A /**
204N/A * The singleton print stream tied to the null output stream.
204N/A */
204N/A private static final PrintStream printStream =
204N/A new PrintStream(instance);
204N/A
204N/A
204N/A
204N/A /**
204N/A * Retrieves an instance of this null output stream.
204N/A *
204N/A * @return An instance of this null output stream.
204N/A */
204N/A public static NullOutputStream instance()
204N/A {
204N/A return instance;
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Retrieves a print stream using this null output stream.
204N/A *
204N/A * @return A print stream using this null output stream.
204N/A */
204N/A public static PrintStream printStream()
204N/A {
204N/A return printStream;
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Creates a new instance of this null output stream.
204N/A */
204N/A private NullOutputStream()
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Closes the output stream. This has no effect.
204N/A */
204N/A public void close()
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Flushes the output stream. This has no effect.
204N/A */
204N/A public void flush()
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Writes the provided data to this output stream. This has no
204N/A * effect.
204N/A *
204N/A * @param b The byte array containing the data to be written.
204N/A */
204N/A public void write(byte[] b)
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Writes the provided data to this output stream. This has no
204N/A * effect.
204N/A *
204N/A * @param b The byte array containing the data to be written.
204N/A * @param off The offset at which the real data begins.
204N/A * @param len The number of bytes to be written.
204N/A */
204N/A public void write(byte[] b, int off, int len)
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A
204N/A
204N/A
204N/A /**
204N/A * Writes the provided byte to this output stream. This has no
204N/A * effect.
204N/A *
204N/A * @param b The byte to be written.
204N/A */
204N/A public void write(int b)
204N/A {
204N/A // No implementation is required.
204N/A }
204N/A}
204N/A