Created
July 17, 2016 15:45
-
-
Save josinSbazin/a8efad6b37fa848ac7b1afe8400f8e75 to your computer and use it in GitHub Desktop.
level19.lesson05.task04
This file contains 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.level19.lesson05.task04; | |
/* Замена знаков | |
Считать с консоли 2 имени файла. | |
Первый Файл содержит текст. | |
Заменить все точки "." на знак "!", вывести во второй файл. | |
Закрыть потоки. Не использовать try-with-resources | |
*/ | |
import java.io.*; | |
public class Solution { | |
public static void main(String[] args) throws IOException { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
String fileNameIn = reader.readLine(); | |
String fileNameOut = reader.readLine(); | |
reader.close(); | |
FileInputStream fileIn = new FileInputStream(fileNameIn); | |
FileOutputStream fileOut = new FileOutputStream(fileNameOut); | |
while (fileIn.available()>0) { | |
int data = fileIn.read(); | |
if (data == 46) data = 33; | |
fileOut.write(data); | |
} | |
fileIn.close(); | |
fileOut.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment