PHP's unpack method functionality in Java
I am wondering what the algorithm behind unpack()
method in PHP is? Is there maybe an equivalent in Java which I could use?
开发者_开发问答What would be the best way to implement PHP unpack()
method in Java?
The nearest functionality is the DataInputStream/DataOutputStream pair.
I believe the closest in java in Object Serialisation.
See java.io.ObjectOutputStream
and java.io.ObjectInputStream
as always there is a library method to wrap this stuff up a couple of nice convenient methods
in commons-lang:
- SerializationUtils.serialize(Serializable);
- SerializationUtils.deserialize(byte[]);
But this isn't going to help you with php to java interop.
精彩评论