1
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

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any equivalent method for struct.pack in java to implement the same functionality pump_on = struct.pack("IIHHI", 0, 0, 21, 96, 512) i am trying to pack a value .. so in java is there function to pack like in python struct.pack function .. If any suggestions kindly advice me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.