All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.io.stream.ClosedOutputStream Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.io.stream;

import java.io.IOException;
import java.io.OutputStream;

/**
 * Closed output stream. This stream throws an exception on all attempts to write something to the
 * stream.
 * 

* Typically uses of this class include testing for corner cases in methods that accept an output * stream and acting as a sentinel value instead of a {@code null} output stream. */ public class ClosedOutputStream extends OutputStream { /** * A singleton. */ public static final ClosedOutputStream INSTANCE = new ClosedOutputStream(); /** * Throws an {@link IOException} to indicate that the stream is closed. * * @param b ignored * @throws IOException always thrown */ @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy