| 1 | package stream; |
| 2 | |
| 3 | import java.io.IOException; |
| 4 | import java.io.OutputStream; |
| 5 | |
| 6 | /** Writes to nowhere. |
| 7 | * Courtesy of https://stackoverflow.com/a/692580 and https://stackoverflow.com/a/691835 */ |
| 8 | public class NullOutputStream extends OutputStream { |
| 9 | |
| 10 | @Override |
| 11 | public void write(int b) throws IOException {} |
| 12 | |
| 13 | @Override |
| 14 | public void write(byte[] b) throws IOException {} |
| 15 | |
| 16 | @Override |
| 17 | public void write(byte[] b, int off, int len) throws IOException {} |
| 18 | |
| 19 | } |