Created
July 17, 2016 14:15
-
-
Save josinSbazin/4af72e1031b8b891d7dcddfd49e7bd31 to your computer and use it in GitHub Desktop.
level19.lesson05.task01
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.task01; | |
/* Четные байты | |
Считать с консоли 2 имени файла. | |
Вывести во второй файл все байты с четным индексом. | |
Пример: второй байт, четвертый байт, шестой байт и т.д. | |
Закрыть потоки ввода-вывода. | |
*/ | |
import java.io.*; | |
public class Solution { | |
public static void main(String[] args) throws IOException { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
String fileNameOne = reader.readLine(); | |
String fileNameTwo = reader.readLine(); | |
reader.close(); | |
FileInputStream fileIn = new FileInputStream(fileNameOne); | |
FileOutputStream fileOut = new FileOutputStream(fileNameTwo); | |
int data; | |
while (fileIn.available()>0) { | |
fileIn.read(); | |
data = fileIn.read(); | |
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