001/* 002 * Copyright (C) 2004 The Guava Authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.google.common.io; 018 019import static com.google.common.base.Preconditions.checkNotNull; 020 021import com.google.common.annotations.Beta; 022 023import java.io.OutputStream; 024 025/** 026 * Implementation of {@link OutputStream} that simply discards written bytes. 027 * 028 * @author Spencer Kimball 029 * @since 1.0 030 * @deprecated Use {@link ByteStreams#nullOutputStream} instead. This class is 031 * scheduled to be removed in Guava release 15.0. 032 */ 033@Beta 034@Deprecated 035public final class NullOutputStream extends OutputStream { 036 /** Discards the specified byte. */ 037 @Override public void write(int b) { 038 } 039 040 /** Discards the specified byte array. */ 041 @Override public void write(byte[] b, int off, int len) { 042 checkNotNull(b); 043 } 044}