Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Solution {
- public static void main(String[] args) throws IOException {
- boolean flag = true;
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
- String sourceFileName = reader.readLine();
- String destinationFileName = reader.readLine();
- while (flag) {
- try (FileOutputStream fileOutputStream = new FileOutputStream(destinationFileName);
- FileInputStream fileInputStream = new FileInputStream(sourceFileName)) {
- int value;
- char content;
- while ((value = fileInputStream.read()) != -1) {
- content = (char) value;
- fileOutputStream.write(content);
- }
- flag = false;
- }
- catch (FileNotFoundException e) {
- System.out.println("Файл не существует.");
- sourceFileName = reader.readLine();
- }
- }
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement