Skip to content

Instantly share code, notes, and snippets.

@BepBop
BepBop / inout.java
Created February 21, 2022 13:34 — forked from kosta/inout.java
Copy stdin to stdout in Java
import java.io.IOException;
/**
* Class that copies stdin to stdout, as compained about as not being cleanly
* writable in Java on Hacker News.
* In real code, you would just write IOUtils.copy(System.in, System.out),
* which does basically the same thing.
* This does not catch any exceptions as a) this is just an "exercise" and
* b) all we could do with them is pretty-print them. So let the runtime
* print them for you.