Preon library problem
        Posted  
        
            by 
                Kamahire
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kamahire
        
        
        
        Published on 2011-01-05T08:39:28Z
        Indexed on 
            2011/01/05
            8:53 UTC
        
        
        Read the original article
        Hit count: 205
        
I am using preon lib to parse binary data it contain short, int data
The structure as follows
@BoundNumber(size="32", byteOrder=ByteOrder.BigEndian) public int time;//
@BoundString(size="2") public String alphaChar;// 2 byte array
@BoundNumber(size="16", byteOrder=ByteOrder.BigEndian) public int code1;//short
@BoundNumber(size="16", byteOrder=ByteOrder.BigEndian) public int code2;//short
@BoundNumber(size="16", byteOrder=ByteOrder.BigEndian) public int code3;//short
@BoundString(size="8") public String firstName;// 8 byte array
@BoundString(size="8") public String middleName;// 8 byte array
@BoundString(size="8") public String lastName;// 8 byte array
@BoundNumber(size="16", byteOrder=ByteOrder.BigEndian) public int code4;//short
I am getting correct values for code1, code2, code3 but for code4 it not giving me correct value. It always gives me 0(Zero); When I checked with position of byte array; it shows me correct value.
Is there any kind padding require?
© Stack Overflow or respective owner