src/main/java/org/tinyradius/attribute/VendorSpecificAttribute.java
public void readAttribute(byte[] data, int offset, int length)
        throws RadiusException {
        // check length
        if (length < 6) {
            throw new RadiusException("Vendor-Specific attribute too short: "
                + length);
        }

        int vsaCode = data[offset];
        int vsaLen = ((int) data[offset + 1] & 0x000000ff) - 6;

        if (vsaCode != VENDOR_SPECIFIC) {
            throw new RadiusException("not a Vendor-Specific attribute");
        }

        // read vendor ID and vendor data
        /*
         * int vendorId = (data[offset + 2] << 24 | data[offset + 3] << 16 |
		 * data[offset + 4] << 8 | ((int)data[offset + 5] & 0x000000ff));
		 */
        int vendorId = (unsignedByteToInt(data[offset + 2]) << 24
            | unsignedByteToInt(data[offset + 3]) << 16
            | unsignedByteToInt(data[offset + 4]) << 8 | unsignedByteToInt(data[offset + 5]));
        setChildVendorId(vendorId);

        // validate sub-attribute structure
        int pos = 0;
        int count = 0;
        while (pos < vsaLen) {
            if (pos + 1 >= vsaLen) {
                throw new RadiusException("Vendor-Specific attribute malformed");
            }
            // int vsaSubType = data[(offset + 6) + pos] & 0x0ff;
            int vsaSubLen = data[(offset + 6) + pos + 1] & 0x0ff;
            pos += vsaSubLen;
            count++;
        }
        if (pos != vsaLen) {
            throw new RadiusException("Vendor-Specific attribute malformed");
        }

        subAttributes = new ArrayList<RadiusAttribute>(count);
        pos = 0;
        while (pos < vsaLen) {
            int subtype = data[(offset + 6) + pos] & 0x0ff;
            int sublength = data[(offset + 6) + pos + 1] & 0x0ff;
            RadiusAttribute a = createRadiusAttribute(getDictionary(),
                vendorId, subtype);
            a.readAttribute(data, (offset + 6) + pos, sublength);
            subAttributes.add(a);
            pos += sublength;
        }
    }
/**
     * Reads a Vendor-Specific attribute and decodes the internal sub-attribute
     * structure.
     *
     * @see org.tinyradius.attribute.RadiusAttribute#readAttribute(byte[], int,
     * int)
     */
Reads a Vendor-Specific attribute and decodes the internal sub-attribute
structure.


Reads a Vendor - Specific attribute and decodes the internal sub - attribute structure .
public void readAttribute(byte[] data, int offset, int length)
        throws RadiusException {
        if (length < 6) {
            throw new RadiusException("Vendor-Specific attribute too short: "
                + length);
        }
        int vsaCode = data[offset];
        int vsaLen = ((int) data[offset + 1] & 0x000000ff) - 6;
        if (vsaCode != VENDOR_SPECIFIC) {
            throw new RadiusException("not a Vendor-Specific attribute");
        }
        /*
         * int vendorId = (data[offset + 2] << 24 | data[offset + 3] << 16 |
		 * data[offset + 4] << 8 | ((int)data[offset + 5] & 0x000000ff));
		 */
        int vendorId = (unsignedByteToInt(data[offset + 2]) << 24
            | unsignedByteToInt(data[offset + 3]) << 16
            | unsignedByteToInt(data[offset + 4]) << 8 | unsignedByteToInt(data[offset + 5]));
        setChildVendorId(vendorId);
        int pos = 0;
        int count = 0;
        while (pos < vsaLen) {
            if (pos + 1 >= vsaLen) {
                throw new RadiusException("Vendor-Specific attribute malformed");
            }
            int vsaSubLen = data[(offset + 6) + pos + 1] & 0x0ff;
            pos += vsaSubLen;
            count++;
        }
        if (pos != vsaLen) {
            throw new RadiusException("Vendor-Specific attribute malformed");
        }
        subAttributes = new ArrayList<RadiusAttribute>(count);
        pos = 0;
        while (pos < vsaLen) {
            int subtype = data[(offset + 6) + pos] & 0x0ff;
            int sublength = data[(offset + 6) + pos + 1] & 0x0ff;
            RadiusAttribute a = createRadiusAttribute(getDictionary(),
                vendorId, subtype);
            a.readAttribute(data, (offset + 6) + pos, sublength);
            subAttributes.add(a);
            pos += sublength;
        }
    }
public void readAttribute ( byte [ ] data , int offset , int length ) throws RadiusException { if ( length < 6 ) { throw new RadiusException ( "Vendor-Specific attribute too short: " + length ) ; } int vsaCode = data [ offset ] ; int vsaLen = ( ( int ) data [ offset + 1 ] & 0x000000ff ) - 6 ; if ( vsaCode != VENDOR_SPECIFIC ) { throw new RadiusException ( "not a Vendor-Specific attribute" ) ; } /*
         * int vendorId = (data[offset + 2] << 24 | data[offset + 3] << 16 |
		 * data[offset + 4] << 8 | ((int)data[offset + 5] & 0x000000ff));
		 */ int vendorId = ( unsignedByteToInt ( data [ offset + 2 ] ) << 24 | unsignedByteToInt ( data [ offset + 3 ] ) << 16 | unsignedByteToInt ( data [ offset + 4 ] ) << 8 | unsignedByteToInt ( data [ offset + 5 ] ) ) ; setChildVendorId ( vendorId ) ; int pos = 0 ; int count = 0 ; while ( pos < vsaLen ) { if ( pos + 1 >= vsaLen ) { throw new RadiusException ( "Vendor-Specific attribute malformed" ) ; } int vsaSubLen = data [ ( offset + 6 ) + pos + 1 ] & 0x0ff ; pos += vsaSubLen ; count ++ ; } if ( pos != vsaLen ) { throw new RadiusException ( "Vendor-Specific attribute malformed" ) ; } subAttributes = new ArrayList < RadiusAttribute > ( count ) ; pos = 0 ; while ( pos < vsaLen ) { int subtype = data [ ( offset + 6 ) + pos ] & 0x0ff ; int sublength = data [ ( offset + 6 ) + pos + 1 ] & 0x0ff ; RadiusAttribute a = createRadiusAttribute ( getDictionary ( ) , vendorId , subtype ) ; a . readAttribute ( data , ( offset + 6 ) + pos , sublength ) ; subAttributes . add ( a ) ; pos += sublength ; } }
Reads a Vendor-Specific attribute and decodes the internal sub-attribute
 structure.
Reads a Vendor - Specific attribute and decodes the internal sub - attribute structure .
// check length
 // read vendor ID and vendor data
 // validate sub-attribute structure
 // int vsaSubType = data[(offset + 6) + pos] & 0x0ff;
