hehehe. i've said that a few times as well. you can (annoyingly) get it by a) using bytes and hoping you only need 16 bits, or b) using a type that's greater than what you want and hoping you get the math right.
Damn Joethorntonrobblakejamesgoslingleaf conspiracytagueNovember 13 2008, 23:46:46 UTC
Actually that doesn't wor for my problem.
I'm trying to read in data packets from the network. The packets have a 4-byte type code, a 4-byte length code, followed by a variable length byte-buffer of message-y goodness.
Now here's the rub, byte arrays in Java can only be indexed using an integer, so if the client starts to be a chatty-cathy I'm screwed. (Okay, I'm probably exceptionally unhappy if I need 32-bits of length, but still...)
It's not like I'm trying to create a cherry-flavored maglev goat here. For someone who keeps telling us the network is the computer, they damn well forgot about all these 4-byte unsigned ints floating around on the damn intrawebz.
Comments 3
*sigh*
Reply
I'm trying to read in data packets from the network. The packets have a 4-byte type code, a 4-byte length code, followed by a variable length byte-buffer of message-y goodness.
Now here's the rub, byte arrays in Java can only be indexed using an integer, so if the client starts to be a chatty-cathy I'm screwed. (Okay, I'm probably exceptionally unhappy if I need 32-bits of length, but still...)
It's not like I'm trying to create a cherry-flavored maglev goat here. For someone who keeps telling us the network is the computer, they damn well forgot about all these 4-byte unsigned ints floating around on the damn intrawebz.
Reply
http://darksleep.com/player/JavaAndUnsignedTypes.html
Reply
Leave a comment