This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Python's struct.pack in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Reply locked New topic
Author

Python's struct.pack in Java

thiruvadi esakki
Greenhorn

Joined: Jul 09, 2010
Posts: 1
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)

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
Same question as http://www.coderanch.com/t/502130/java/java/same-output-format-java, closing this one.

If you have two accounts, let us now which one you want to keep so that we can close the other one.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Python's struct.pack in Java
 
Similar Threads
Jython with JDK1.5
JPython - what is it exactly?
repr() equivalent?
Why Java at all?
CRC16 with Polynominal : 0x8408, and Preset CRC : 0x6363