package com.javarush.task.task09.task0929;
import java.io.*;
/*
Обогатим код функциональностью!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sourceFileName1 = reader.readLine();
String sourceFileName2 = reader.readLine();
InputStream is = null;
OutputStream os = null;
while (is == null) {
try {
is = getInputStream(sourceFileName1);
}
catch (FileNotFoundException e) {
System.out.println("Файл не существует.");
sourceFileName1 = reader.readLine();
}
}
os = getOutputStream(sourceFileName2);
while (is.available() > 0) {
int data = is.read();
os.write(data);
}
is.close();
os.close();
}
public static InputStream getInputStream(String fileName) throws IOException {
return new FileInputStream(fileName);
}
public static OutputStream getOutputStream(String fileName) throws IOException {
return new FileOutputStream(fileName);
}
}
package com.javarush.task.task09.task0929;
import java.io.*;
/*
Обогатим код функциональностью!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sourceFileName1 = reader.readLine();
String sourceFileName2 = reader.readLine();
InputStream is = null;
OutputStream os = null;
while (is == null) {
try {
is = getInputStream(sourceFileName1);
}
catch (FileNotFoundException e) {
System.out.println("Файл не существует.");
sourceFileName1 = reader.readLine();
}
}
os = getOutputStream(sourceFileName2);
while (is.available() > 0) {
int data = is.read();
os.write(data);
}
is.close();
os.close();
}
public static InputStream getInputStream(String fileName) throws IOException {
return new FileInputStream(fileName);
}
public static OutputStream getOutputStream(String fileName) throws IOException {
return new FileOutputStream(fileName);
}
}