Created
December 7, 2010 16:20
-
-
Save nobeans/731986 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class Hoge { | |
public static void main(String[] args) throws Exception { | |
try (BufferedInputStream is = new BufferedInputStream( new FileInputStream(new File("/tmp/hoge"))); | |
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(new File("/tmp/foo")))) { | |
int length = 0; | |
byte[] buffer = new byte[1024]; | |
while ((length = is.read(buffer)) >= 0) { | |
System.out.write(buffer, 0, length); | |
os.write(buffer, 0, length); | |
} | |
} | |
System.out.println("Done."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment