开发者

PHP's unpack method functionality in Java

开发者 https://www.devze.com 2023-01-13 22:08 出处:网络
I am wondering what the algorithm behind unpack() method in PHP is? Is there maybe an equivalent in Java which I could use?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号