callback - Java-Gearman-Service - Handle GearmanJobEventCallback::onEvent and byte[] in GearmanFunction -
I am using Gearman to distribute different functions and therefore I use to implement clients and workers I am doing
However, I understand I can not find ; T & gt; :: onEvent : How can I change the byte array to How can I "decode" with the return data of the work method? How do I "decode" to I have found a way to solve it, hopefully That it helps anyone, who comes into this problem. It seems that byte array values are entries from an ASCII table and put together in a byte array: Hope it helps :) Understand the data obtained in GearmanJobEventCallback & lt;
event.getData () data? Like situation or back data? When I send the position (3, 10) it gives a byte array [51,0,49,48] - it is not very useful for my client, unserializing with ObjectInputStream does not seem successful.
work method by
gearman function
data logic (byte Array) Any input will be greatly appreciated! D
string number = ""; String denominator Str = ""; Boolean Writer = True; (For Byte B: event.getData ()) {if (b == 0) {writeNumerator = false; to continue; } If (written number) {numeratorStr + = (char) b; } Else {denominatorStr + = (char) b; }} Int numerator = integer Persian (numeratorStr); Int denominator = integer. Den (denominatorStr);
Comments
Post a Comment