16c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom/* 26c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * Copyright (C) 2010 The Android Open Source Project 36c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * 46c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * Licensed under the Apache License, Version 2.0 (the "License"); 56c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * you may not use this file except in compliance with the License. 66c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * You may obtain a copy of the License at 76c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * 86c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * http://www.apache.org/licenses/LICENSE-2.0 96c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * 106c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * Unless required by applicable law or agreed to in writing, software 116c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * distributed under the License is distributed on an "AS IS" BASIS, 126c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * See the License for the specific language governing permissions and 146c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * limitations under the License. 156c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom */ 166c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom 176c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrompackage libcore.java.io; 186c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom 196c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstromimport java.io.ByteArrayOutputStream; 206c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstromimport java.io.OutputStream; 216c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstromimport java.io.PrintStream; 226c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstromimport java.util.Locale; 236c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom 246c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom/** 256c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom * A PrintStream that throws away its output. 266c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom */ 276c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrompublic final class NullPrintStream extends PrintStream { 286c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public NullPrintStream() { 296c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom // super class complains if argument is null 306c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom super((OutputStream) new ByteArrayOutputStream()); 316c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom } 326c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public boolean checkError() { return false; } 336c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom protected void clearError() {} 346c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void close() {} 356c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void flush() {} 366c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream format(String format, Object... args) { return this; } 376c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream format(Locale l, String format, Object... args) { return this; } 386c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream printf(String format, Object... args) { return this; } 396c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream printf(Locale l, String format, Object... args) { return this; } 406c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(char[] charArray) {} 416c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(char ch) {} 426c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(double dnum) {} 436c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(float fnum) {} 446c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(int inum) {} 456c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(long lnum) {} 466c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(Object obj) {} 476c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(String str) {} 486c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void print(boolean bool) {} 496c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println() {} 506c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(char[] charArray) {} 516c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(char ch) {} 526c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(double dnum) {} 536c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(float fnum) {} 546c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(int inum) {} 556c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(long lnum) {} 566c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(Object obj) {} 576c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(String str) {} 586c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void println(boolean bool) {} 596c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom protected void setError() {} 606c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void write(byte[] buffer, int offset, int length) {} 616c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public void write(int oneByte) {} 626c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream append(char c) { return this; } 636c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream append(CharSequence csq) { return this; } 646c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom public PrintStream append(CharSequence csq, int start, int end) { return this; } 656c78b7b94c232063ec559436b48b33751373ecf1Brian Carlstrom} 66