![JAR search and dependency download from the Maven repository](/logo.png)
panda.io.stream.ClosedInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.io.stream;
import java.io.InputStream;
/**
* Closed input stream. This stream returns -1 to all attempts to read something from the stream.
*
* Typically uses of this class include testing for corner cases in methods that accept input
* streams and acting as a sentinel value instead of a {@code null} input stream.
*/
public class ClosedInputStream extends InputStream {
/**
* A singleton.
*/
public static final ClosedInputStream INSTANCE = new ClosedInputStream();
/**
* Returns -1 to indicate that the stream is closed.
*
* @return always -1
*/
@Override
public int read() {
return -1;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy