Pass byte[] from java to Haxe , but get Array<Int>?

I use jni to run java code and return byte[] ,

private static var ext_load_bytes = JNI.createStaticMethod("org.haxe.extension.demo", "loadImg", "(Ljava/lang/String;)[B");
Log.i("java.hx:","outstream size = "+outStream.size());
Log.i("java.hx:","outstream content = "+outStream.toString());
return outStream.toByteArray();

But get an array< int > in haxe.

↑ java byte[]
↓ haxe Array?

I want to load some picture or zip from url so I need haxe.io.Bytes . Maybe I can do something to transform this Array< int > or I can get just Bytes data from java ?

Sorry for my poor English. == . Hope you guys can understand my problem and give me some responses.Thanks!

I had a similar problem sending a byte[] to java. So the other way around.
In the end I decided to encode the data as a string.

Perhaps this is of some use to you:

JAVA

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

public static int stringexample (String bmpData) {
	int result=bmpData.length();
	byte[] bmpByteArray = android.util.Base64.decode(bmpData, Base64.DEFAULT);
	result=bmpByteArray.length;
	Bitmap bmp = null;
	try {
                bmp = BitmapFactory.decodeByteArray(bmpByteArray,0,bmpByteArray.length);
	} catch (IllegalArgumentException e) { return -1; }
    ...
}


HAXE

import flash.display.Bitmap;
import openfl.display.BitmapData;
import flash.display.Sprite;
import flash.text.TextField;
import flash.utils.ByteArray;
import haxe.io.Bytes;
import haxe.io.BytesData;
import haxe.crypto.Base64;
import openfl.display.PNGEncoderOptions;

{
        var bmp:BitmapData = new BitmapData(100, 100, true, 0xFF000000);
	var data:ByteArray = bmp.encode(bmp.rect, new PNGEncoderOptions());
	data.position = 0;
	var result:Int = javacode.stringexample(Base64.encode(data));
}

Yes,I also used Base64 to make my code work.

But…It annoyed me for the waste of meaningless encoding and decoding though it was necessary in this way.

By the way, when I passed Base64 from Java to Haxe , the base64string was added some line break( a bit kindness?) which made the base64.decode in haxe threw an error of invalid char. So i encoded base64 in java with the flags arg Base64.NO_WRAP.