package com.ninty.nativee.io;

import com.ninty.nativee.INativeMethod;
import com.ninty.nativee.NaMethodManager;
import com.ninty.runtime.NiFrame;

/**
 * Created by ninty on 2017/10/21.
 */
public class NaFileOutputStream {
    private final static String className = "java/io/FileOutputStream";

    public static void init() {
        NaMethodManager.register(className, "initIDs", "()V",
                new initIDs());
    }

    public static class initIDs implements INativeMethod {
        @Override
        public void invoke(NiFrame frame) {
        }
    }
}

@@ -131,23 +131,99 @@
 runtime.
-NiFrame
+LocalVars;%0Aimport com.ninty.runtime.NiFrame;%0Aimport com.ninty.runtime.heap.NiObject
 ;%0A%0A/**%0A 
@@ -493,16 +493,121 @@
 IDs());%0A
+        NaMethodManager.register(className, %22writeBytes%22, %22(%5BBIIZ)V%22,%0A                new writeBytes());%0A
     %7D%0A%0A 
@@ -741,11 +741,411 @@
  %7D%0A    %7D
+%0A%0A    public static class writeBytes implements INativeMethod %7B%0A        @Override%0A        public void invoke(NiFrame frame) %7B%0A            LocalVars localVars = frame.getLocalVars();%0A            NiObject datas = localVars.getRef(1);%0A            int offset = localVars.getInt(2);%0A            int length = localVars.getInt(3);%0A            System.out.write(datas.abyte(), offset, length);%0A        %7D%0A    %7D
 %0A%7D%0A

add native method: java.io.FileOutputStream.writeBytes([BIIZ)V