Skip to content

Instantly share code, notes, and snippets.

@OlgaKulikova
Created January 30, 2015 12:06
Show Gist options
  • Save OlgaKulikova/6ff2627a8aee8c73618f to your computer and use it in GitHub Desktop.
Save OlgaKulikova/6ff2627a8aee8c73618f to your computer and use it in GitHub Desktop.
Copy file
public class Solution
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sourceFileName = reader.readLine();
String destinationFileName = reader.readLine();
java.io.FileInputStream fileInputStream = new java.io.FileInputStream(sourceFileName);
java.io.FileOutputStream fileOutputStream = new java.io.FileOutputStream(destinationFileName);
int count = 0;
while (fileInputStream.available()>0)
{
int data = fileInputStream.read();
fileOutputStream.write(data);
count++;
}
System.out.println("Скопировано байт " + count);
fileOutputStream.close();
fileInputStream.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment