Skip to content

Instantly share code, notes, and snippets.

@cbsmith
Created March 25, 2014 05:38
Show Gist options
  • Select an option

  • Save cbsmith/9755809 to your computer and use it in GitHub Desktop.

Select an option

Save cbsmith/9755809 to your computer and use it in GitHub Desktop.
A simply gist demonstrating how to copy from stdin to stdout in Java, in response to discussion of: https://news.ycombinator.com/item?id=7463671
public class Copy {
public static void main(String[] args) throws Throwable {
int next;
while ((next = System.in.read()) != -1) {
System.out.write(next);
}
System.out.flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment