Thanks
@DonManfred however this is throwing an error like some other approaches I've tried.
Based on your code I tried:
Dim In As InputStream
In.InitializeFromBytesArray(bytebuffer, 0, bytebuffer.RunMethod("capacity",Null))
Dim bmp As Image
bmp.Initialize2(In)
ivMain.SetImage(bmp)
but it throws the error:
main._btnrecvframes_click (java line: 196)
java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to [B
at b4j.example.main._btnrecvframes_click(main.java:196)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA$1.run(BA.java:216)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
It seems that a ByteBuffer cannot be cast to a byte array.
Perhaps I have to use the BytesBuilder class to iteratively build a bytes array from the data within the ByteBuffer and use that in the In.InitializeFromBytesArray statement.