Last active
December 16, 2015 07:59
-
-
Save wsky/5402836 to your computer and use it in GitHub Desktop.
usually bytes parse code, big/little edian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//c# byte 0-255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//java byte -128 to 127 | |
short len = ((chunkData.get()&0xFF)<<8) | (chunkData.get()&0xFF); | |
//can support .net(c#) usignedbyte | |
ByteBuffer buffer = ByteBuffer.wrap(new byte[] { (byte) 160, (byte) 134, 1, 0 }); | |
buffer.order(ByteOrder.LITTLE_ENDIAN); | |
assertEquals(100000, buffer.getInt()); | |
buffer = ByteBuffer.wrap(new byte[] { -96, -122, 1, 0 }); | |
buffer.order(ByteOrder.LITTLE_ENDIAN); | |
assertEquals(100000, buffer.getInt()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment