Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.task.task18.task1826;
- /*
- Шифровка
- */
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- public class Solution {
- public static void main(String[] args) {
- try {
- if (args[0].equals("-e")) {
- paramE(args);
- } else {
- paramD(args);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static void paramE(String[] args) throws IOException {
- FileInputStream inputStream = new FileInputStream(args[1]);
- FileOutputStream outputStream = new FileOutputStream(args[2]);
- while (inputStream.available() > 0) {
- outputStream.write(inputStream.read() + 1);
- }
- inputStream.close();
- outputStream.close();
- }
- public static void paramD(String[] args) throws IOException {
- FileInputStream inputStream = new FileInputStream(args[1]);
- FileOutputStream outputStream = new FileOutputStream(args[2]);
- while (inputStream.available() > 0) {
- outputStream.write(inputStream.read() - 1);
- }
- inputStream.close();
- outputStream.close();
- }
- }
Add Comment
Please, Sign In to add comment