Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Ihor {
- private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- public static void main(String[] args) throws IOException {
- String sourceFileName = reader.readLine();
- String destinationFileName = reader.readLine();
- InputStream inputStream = getInputStream2(sourceFileName);
- OutputStream outputStream = getOutputStream(destinationFileName);
- while (inputStream.available() > 0) {
- outputStream.write(inputStream.read());
- }
- }
- private static InputStream getInputStream2(String fileName) throws IOException {
- try {
- return getInputStream(fileName);
- } catch (FileNotFoundException e) {
- return getInputStream2(reader.readLine());
- }
- }
- private static InputStream getInputStream(String fileName) throws IOException {
- return new FileInputStream(fileName);
- }
- private static OutputStream getOutputStream(String fileName) throws IOException {
- return new FileOutputStream(fileName);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement