Created
December 6, 2015 11:26
-
-
Save ProZhar/81d1476b656607b65518 to your computer and use it in GitHub Desktop.
com.javarush.test.level09.lesson11.bonus01
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
| package com.javarush.test.level09.lesson11.bonus01; | |
| import java.io.*; | |
| /* Нужно исправить программу, чтобы компилировалась и работала | |
| Задача: Программа вводит два имени файла. И копирует первый файл на место заданное вторым именем. | |
| */ | |
| 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(); | |
| FileInputStream fileInputStream = new FileInputStream(sourceFileName); | |
| FileOutputStream fileOutputStream = new FileOutputStream(destinationFileName); | |
| int count = 0; | |
| while (fileInputStream.available()>0) | |
| { | |
| int data = fileInputStream.read(); | |
| fileOutputStream.write(data); | |
| count++; | |
| } | |
| System.out.println("Скопировано байт " + count); | |
| fileInputStream.close(); | |
| fileOutputStream.close(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment