Skip to content

Instantly share code, notes, and snippets.

@josinSbazin
Created July 17, 2016 14:15
Show Gist options
  • Save josinSbazin/4af72e1031b8b891d7dcddfd49e7bd31 to your computer and use it in GitHub Desktop.
Save josinSbazin/4af72e1031b8b891d7dcddfd49e7bd31 to your computer and use it in GitHub Desktop.
level19.lesson05.task01
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