Android Question [B4X] [Solved] Porting B4XSerializator to Php

Toky Olivier

Active Member
Licensed User
Longtime User
Hello,
I tried to port B4XSerializator to php for my project based on the source here https://www.b4x.com/android/forum/threads/b4x-net-framework-implementation-of-b4xserializator.73080/
I'm just in the beginning but my probem is when I use it with B4J (just little test of communication), I have error bellow. I think it about how I compress data in the php version. Do someone has idea, how to do it? I used gzuncompress, gzencode, gzdeflate functions but none of them work. What I understood is that the Inflate/Deflate functions in the C# library ICSharpCode.SharpZipLib use rfc1951 standard + rfc1950 headers/footers but normally, those php functions use also these standard. Do I missed something?
ps: In php only, the ported code works as expected. The php code is attached.

B4X:
Waiting for debugger to connect...
Program started.
Error occurred on line: 70 (ClientKVS)
java.util.zip.ZipException: incorrect header check
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122)
    at java.io.DataInputStream.readByte(DataInputStream.java:265)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readByte(B4XSerializator.java:133)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:301)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:112)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:82)
    at b4j.example.clientkvs._jobdone(clientkvs.java:736)
    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.shell.Shell.runMethod(Shell.java:614)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    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:90)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:480)
    at anywheresoftware.b4a.keywords.Common.access$0(Common.java:460)
    at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:534)
    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)
data: x�cdc``J��/�
 

Attachments

  • B4XSerializatorPhP.zip
    5.4 KB · Views: 375
Top