I want to convert the value 11 which is an integer into 0000000000001011 so that i can then decompose this string into bytes and transforme those bytes back into integer. For this example I will have to take bytes 0 to 12 then 12 to 16 and associate the translate value to a key.
I tried to use stringToStream as the documentation says but i only have an “inputStream” in return that i can’t read. (Not even with the streamToReader).
I insiste on the fact that i am on webmethods.io - flowservices so i can’t (or i don’t know how maybe) create a nodejs connector and integrate it to my flowservice (we can only do that on workflows i think).
same question here as in the referenced thread:
What is your use case for this requirement?
Can you provide some screenshots of the steps you have tried so far, i.e. using pub.string:stringToBytes?
So we can check what is happening here.
As I have never worked with webMethods.io, I might not be able to assist further.
Hopefully, there will be some other members to pick up this thread and continue the analysis with you.
bytes (or better bytes) is an object data type in the pipeline which cannot be displayed in clear text.
Instead of this it is only showing a pointer address where the data is stored in the JVM memory.
Same applies to stream.
I am still no seeing the use case for such transformation.
Can you elaborate on this further, please?
When you really need to do this, you can do it “manually” as it was teached in school/studies:
REPEAT until value equals 0
- divide your value by 2 and append the remainder as an element of a char[].
- set value to the result of the devision without remainder
END REPEAT
get the length of the resulting char array
set the final result to char[] with length "16-length of array" filled with 0 and append the result from the repeat.
Regarding this:
Hopefully, you meant bytes 0 to 7 and 8 to 15, as a byte has always 8 binary digits.
Can you provide us the expected final outcome of your sample above for better understanding, please?