How to read String in java that was written using python’s struct.pack method

out.write( struct.pack(">f", 1.1) );
out.write( struct.pack(">i", 12) );
out.write( struct.pack(">3s", "abc") );

how to import struct package in java it says ..

no package found when i am trying to execute it

so kindly tell me any suggestions if any

Thanking you

i took that code from How to read String in java that was written using python's struct.pack method

Answers


Read the answer to the question you referenced. The sample code in the question was incorrect.

Also, you don't import the struct package in Java. It's a Python package. Also as described in the other question, you use java.io.DataInputStream to read the file created from Python.


Need Your Help

How can I use a function inside a php foreach loop?

php

I want to use a function inside my loop, in order to print my data in a nice format into my table.

Extract som info of xml file while keeping header lines/nodes

c# .net xml winforms visual-studio

I have an XML file which I want to extract some data from it. I have read all the questions regard this topic here as well as answers. But I want I want to have is keeping header while extracting s...