Is there any function equivalent to Python's struct.pack
in Java that allows me to pack and unpack values like this?
pump_on = struct.pack("IIHHI", 0, 0, 21, 96, 512)
Is there any function equivalent to Python's struct.pack
in Java that allows me to pack and unpack values like this?
pump_on = struct.pack("IIHHI", 0, 0, 21, 96, 512)
I think what you may be after is a ByteBuffer:
Something like this:
Later, you can read that data:
Closest feature in core Java is Serialization. It converts object into byte sequence and back.
I started development of project which is very close to Python Struct: java-binary-block-parser in JBBP it will look like