|
|
|
|
|
by netvl
785 days ago
|
|
> I suppose it would be much harder to do it without the transferTo function, No, it would not: public class Test {
public static void main(String[] args) throws Exception {
byte[] buf = new byte[4096];
int read;
while ((read = System.in.read(buf)) > 0) {
System.out.write(buf, 0, read);
}
}
}
I imagine it will look pretty much the same in the majority of languages which have similar I/O abstractions. |
|