Looking for a good way to get values from a byte array.
-
I have a byte array that contains all kinds of info. Like Bits Purpose 7-4 Color ... 15-9 Length ... If this was my class
class BasePacket{ private byte[] data;//Stores the bits .... .... }
I like to be able doBasePacket x = .....; x.color = 5; x.length = 3; int y = x.color; ... ...
I know how to write this with &,|,<<, sets and gets but I was wondering if there was a slicker solution. I'd like to define each property on one line. //Available bits color , 4 , 4 length, 9, 7 , , Is this possible? I just looking for ideas not necessarily actual code. Thanks for this great forum and its members. -
I have a byte array that contains all kinds of info. Like Bits Purpose 7-4 Color ... 15-9 Length ... If this was my class
class BasePacket{ private byte[] data;//Stores the bits .... .... }
I like to be able doBasePacket x = .....; x.color = 5; x.length = 3; int y = x.color; ... ...
I know how to write this with &,|,<<, sets and gets but I was wondering if there was a slicker solution. I'd like to define each property on one line. //Available bits color , 4 , 4 length, 9, 7 , , Is this possible? I just looking for ideas not necessarily actual code. Thanks for this great forum and its members.