package ru.matevosyan;


import java.io.*;

/**
 * Created DropAbuses for delete abuses.
 * Created on 09.02.2017.
 * @since 1.0
 * @author Matevosyan Vardan
 * @version 1.0
 */

public class DropAbuses {
    private BufferedWriter stream = null;

    public BufferedWriter getStream() {
        return stream;
    }

    /**
     * dropAbuses created for deleting abuses from String array.
     */

    public void dropAbuses(InputStream in, OutputStream out, String[] abuses) {

            try (BufferedReader buff = new BufferedReader(new InputStreamReader(in))) {
                String s;
                int i = 0;
                while ((s = buff.readLine()) != null) {
                    String[] strings = s.split(" ");

                    for (int p = 0; p < abuses.length; p++) {
                        for (int j = 0; j < strings.length; j++) {
                            if (abuses[p].equals(strings[j])) {
                                strings[j] = null;
                            }
                        }
                    }

                    for (int k = 0; k < strings.length; k++) {
                        if (strings[k] != null) {
//                            String[] splitToWords = new String[strings.length + (strings.length / 2)];
                            try (BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(out))) {
//                                String[] split = abuses[k].split(" ");
//                                ?splitToWords = abuses[k].split(" ");
                                bufferedWriter.write(strings[k]);
                                this.stream = bufferedWriter;
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                    i++;
                }

            } catch (IOException ioe) {
                ioe.printStackTrace();
            }

    }

    @Override
    public String toString() {
        return "DropAbuses{" +
                "stream=" + stream +
                '}';
    }
}

@@ -198,16 +198,17 @@
 buses %7B%0A
+%0A
     priv
@@ -246,78 +246,8 @@
 l;%0A%0A
-    public BufferedWriter getStream() %7B%0A        return stream;%0A    %7D%0A%0A
     
@@ -534,16 +534,18 @@
         
+//
  int i =
@@ -687,41 +687,29 @@
 or (
-int p = 0; p %3C abuses.length; p++
+String abuse : abuses
 ) %7B%0A
@@ -816,12 +816,8 @@
 buse
-s%5Bp%5D
 .equ
@@ -1082,113 +1082,8 @@
 ) %7B%0A
-//                            String%5B%5D splitToWords = new String%5Bstrings.length + (strings.length / 2)%5D;%0A
     
@@ -1194,18 +1194,16 @@
 ut))) %7B%0A
-//
         
@@ -1236,43 +1236,22 @@
 ring
-%5B%5D
  sp
-lit = abuses%5Bk%5D.split(
+ace = 
 %22 %22
-)
 ;%0A
-//
     
@@ -1282,45 +1282,120 @@
     
-?splitToWords = abuses%5Bk%5D.split(%22 %22);
+if (k == strings.length - 1) %7B%0A                                    space = %22%22;%0A                                %7D
 %0A   
@@ -1454,16 +1454,24 @@
 rings%5Bk%5D
+ + space
 );%0A     
@@ -1731,16 +1731,18 @@
         
+//
  i++;%0A  

edit and it is work