package pw.koj.jetstreem.core;

import java.nio.channels.WritableByteChannel;
import java.io.DataOutputStream;
import java.io.IOException;

public class StrmWriteIO extends Streem {
    private DataOutputStream outStream;

    public StrmWriteIO(StrmQueue queue, DataOutputStream outStream) {
        super(TaskMode.CONS, queue, StrmWriteIO::writeCb, StrmWriteIO::writeClose, null);
        this.outStream = outStream;
    }

    public DataOutputStream outStream() {
        return this.outStream;
    }

    public static void writeCb(Streem strm, Object data) {
        StrmWriteIO ioStrm = (StrmWriteIO)strm;
        DataOutputStream out = ioStrm.outStream();
        String str = (String)data;

        try {
            out.writeUTF(str);
        } catch (IOException ex) {
            System.err.println("I/O error: " + ex.getMessage());
        }
    }

    public static void writeClose(Streem strm, Object data) {
        // TBD
    }

}

@@ -90,52 +90,19 @@
 .io.
-DataOutputStream;%0Aimport java.io.IOException
+PrintStream
 ;%0A%0Ap
@@ -154,25 +154,20 @@
 private 
-DataOutpu
+Prin
 tStream 
@@ -218,25 +218,20 @@
  queue, 
-DataOutpu
+Prin
 tStream 
@@ -387,25 +387,20 @@
  public 
-DataOutpu
+Prin
 tStream 
@@ -570,17 +570,12 @@
     
-DataOutpu
+Prin
 tStr
@@ -608,67 +608,17 @@
 ();%0A
-        String str = (String)data;%0A%0A        try %7B%0A 
+%0A
         
    o
@@ -617,139 +617,24 @@
     
-   
 out.
-writeUTF(str);%0A        %7D catch (IOException ex) %7B%0A            System.err.println(%22I/O error: %22 + ex.getMessage());%0A        %7D
+print(data);
 %0A   
@@ -711,14 +711,73 @@
     
-// TBD
+StrmWriteIO s = (StrmWriteIO)strm;%0A        s.outStream().close();
 %0A   

modify writeCb() and implement writeClose() in StrmWriteIO