import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 25, 2014.
 */

/**
 * 
 * This class is responsible for safe operations on files. This class contain
 * the basic input/output operations.
 * 
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 * 
 */
public class IOOperations {

    /**
     * Object to keep instance of RSA.
     */
    private RSA rsa;

    /**
     * 
     * @param rsa
     */
    public IOOperations(RSA rsa) {
        this.setRsa(rsa);
    }

    /**
     * This method gets RSA instance.
     * 
     * @return the RSA instance.
     */
    public RSA getRsa() {
        return rsa;
    }

    /**
     * This method reads file from given directory.
     * 
     * @param filePath
     *            The directory for file.
     * @return The {@link InputStream} for read file.
     * @throws IOException
     */
    public InputStream readFile(String filePath) throws IOException {
        InputStream InputStream = null;
        File file = new File(filePath);

        if (file.exists()) {
            InputStream = new FileInputStream(file);
        }

        return InputStream;
    }

    /**
     * This method sets RSA instance.
     * 
     * @param rsa
     *            The RSA to set
     */
    public void setRsa(RSA rsa) {
        this.rsa = rsa;
    }

    /**
     * This method creates output stream to write into file.
     * 
     * @param filePath
     *            The directory for file location.
     * @return The {@link OutputStream} for file to write.
     * @throws FileNotFoundException
     */
    public OutputStream writeFile(String filePath) throws FileNotFoundException {
        OutputStream outputStream = null;
        File file = new File(filePath);

        if (file.exists()) {
            outputStream = new FileOutputStream(file);
        }

        return outputStream;
    }

}

@@ -1,24 +1,118 @@
+/**%0A * Project RSA Algorithm.%0A * Copyright Micha%C5%82 Szczygie%C5%82.%0A * Created at Feb 25, 2014.%0A */%0A%0A
 import java.io.File;%0Aimp
@@ -301,102 +301,8 @@
 m;%0A%0A
-/**%0A * Project RSA Algorithm.%0A * Copyright Micha%C5%82 Szczygie%C5%82.%0A * Created at Feb 25, 2014.%0A */%0A%0A
 /**%0A
@@ -515,16 +515,354 @@
 ions %7B%0A%0A
+    /**%0A     * This method encrypt given stream, using %7B@link RSA%7D object.%0A     * %0A     * @param inputStream%0A     *            The %7B@link InputStream%7D with data to encrypt.%0A     * @param rsa%0A     *            The instance of %7B@link RSA%7D encryption.%0A     */%0A    public static void encryptStream(InputStream inputStream, RSA rsa) %7B%0A%0A    %7D%0A%0A
     /**%0A
@@ -895,19 +895,27 @@
 ance of 
+%7B@link 
 RSA
+%7D
 .%0A     *
@@ -957,138 +957,542 @@
   * 
-%0A     * @param rsa%0A     */%0A    public IOOperations(RSA rsa) %7B%0A        this.setRsa(rsa);%0A    %7D%0A%0A    /**%0A     * This method gets RSA
+The constructor for %7B@link IOOperations%7D, which crate instance of this%0A     * class.%0A     * %0A     * @param rsa%0A     *            The instance of %7B@link RSA%7D encryption.%0A     */%0A    public IOOperations(RSA rsa) %7B%0A        this.setRsa(rsa);%0A    %7D%0A%0A    /**%0A     * This method encrypt given stream, using %7B@link RSA%7D object.%0A     * %0A     * @param inputStream%0A     *            The %7B@link InputStream%7D with data to encrypt.%0A     */%0A    public void encryptStream(InputStream inputStream) %7B%0A%0A    %7D%0A%0A    /**%0A     * This method gets %7B@link RSA%7D
  ins
@@ -1525,19 +1525,27 @@
 urn the 
+%7B@link 
 RSA
+%7D
  instanc
@@ -2141,19 +2141,27 @@
 od sets 
+%7B@link 
 RSA
+%7D
  instanc
@@ -2211,19 +2211,27 @@
     The 
+%7B@link 
 RSA
+%7D
  to set%0A

Add template methods for encryption operations