3 ms·
No, I'm saying you are already using a BufferedInputStream and a BufferedOutputStream. That is the problem: you aren't guaranteeing your output matches your inp
by cbsmith 13y ago
No, I'm saying you are already using a BufferedInputStream and a BufferedOutputStream. That is the problem: you aren't guaranteeing your output matches your input.
Try doing this:
dd if=/dev/random of=test_file bs=4000 count=100
java YourClass < test_file > test_output
diff test_file test_output
- cbsmith 13y agoHere's the simpler, likely slower, but nonetheless actually correct solution: https://gist.github.com/cbsmith/9755809 https://gist.github.com/cbsmith/9755809
- deleted 13y ago[deleted]
- dlubarov 13y agoOh, gotcha. The code above with "byte[] buffer" also works since write(byte[], int, int) flushes.