/* * Copyright (c) 2001 Matthew Feldt. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided the copyright notice above is * retained. * * THIS SOFTWARE IS PROVIDED ''AS IS'' AND WITHOUT ANY EXPRESSED OR * IMPLIED WARRANTIES. */ /** * NullWriter.java * * Java Examples In A Nutshell Copyright (c) 2000 David Flanagan * Exercise 3-8: * Write a simple cubclass of Reader named TestReader that returns the same * character (a character passed to the constructor) over and over. The stream * should never reach EOF. Write a trivial subclass of Writer named NullWriter * that simply discards any output sent to it. Streams like these are occasionally * useful for testing and other purposes. Write a test program that reads from the * TestReader and sends its output to a PrintWriter wrapped around a NullWriter. * * @author Matthew Feldt * @version 1.0, 02/12/2001 11:11 */ package com.feldt.examples.io; import java.io.*; public class NullWriter extends Writer { NullWriter() {} public void close() {} public void flush() {} public void write(char[] cbuf) {} public void write(char[] cbuf, int off, int len) {}; public void write(int c) {} public void write(String str) {} public void write(String str, int off, int len) {} }