src/main/java/org/tinyradius/attribute/VendorSpecificAttribute.java
public byte[] writeAttribute() {
        // write vendor ID
        ByteArrayOutputStream bos = new ByteArrayOutputStream(255);
        bos.write(getChildVendorId() >> 24 & 0x0ff);
        bos.write(getChildVendorId() >> 16 & 0x0ff);
        bos.write(getChildVendorId() >> 8 & 0x0ff);
        bos.write(getChildVendorId() & 0x0ff);

        // write sub-attributes
        try {
            for (RadiusAttribute a : subAttributes) {
                bos.write(a.writeAttribute());
            }
        }
        catch (IOException ioe) {
            // occurs never
            throw new RuntimeException("error writing data", ioe);
        }

        // check data length
        byte[] attrData = bos.toByteArray();
        int len = attrData.length;
        if (len > 253) {
            throw new RuntimeException("Vendor-Specific attribute too long: "
                + bos.size());
        }

        // compose attribute
        byte[] attr = new byte[len + 2];
        attr[0] = VENDOR_SPECIFIC; // code
        attr[1] = (byte) (len + 2); // length
        System.arraycopy(attrData, 0, attr, 2, len);
        return attr;
    }
/**
     * Renders this attribute as a byte array.
     *
     * @see org.tinyradius.attribute.RadiusAttribute#writeAttribute()
     */
Renders this attribute as a byte array.


Renders this attribute as a byte array .
public byte[] writeAttribute() {
        ByteArrayOutputStream bos = new ByteArrayOutputStream(255);
        bos.write(getChildVendorId() >> 24 & 0x0ff);
        bos.write(getChildVendorId() >> 16 & 0x0ff);
        bos.write(getChildVendorId() >> 8 & 0x0ff);
        bos.write(getChildVendorId() & 0x0ff);
        try {
            for (RadiusAttribute a : subAttributes) {
                bos.write(a.writeAttribute());
            }
        }
        catch (IOException ioe) {
            throw new RuntimeException("error writing data", ioe);
        }
        byte[] attrData = bos.toByteArray();
        int len = attrData.length;
        if (len > 253) {
            throw new RuntimeException("Vendor-Specific attribute too long: "
                + bos.size());
        }
        byte[] attr = new byte[len + 2];
        attr[0] = VENDOR_SPECIFIC; 
        attr[1] = (byte) (len + 2); 
        System.arraycopy(attrData, 0, attr, 2, len);
        return attr;
    }
public byte [ ] writeAttribute ( ) { ByteArrayOutputStream bos = new ByteArrayOutputStream ( 255 ) ; bos . write ( getChildVendorId ( ) >> 24 & 0x0ff ) ; bos . write ( getChildVendorId ( ) >> 16 & 0x0ff ) ; bos . write ( getChildVendorId ( ) >> 8 & 0x0ff ) ; bos . write ( getChildVendorId ( ) & 0x0ff ) ; try { for ( RadiusAttribute a : subAttributes ) { bos . write ( a . writeAttribute ( ) ) ; } } catch ( IOException ioe ) { throw new RuntimeException ( "error writing data" , ioe ) ; } byte [ ] attrData = bos . toByteArray ( ) ; int len = attrData . length ; if ( len > 253 ) { throw new RuntimeException ( "Vendor-Specific attribute too long: " + bos . size ( ) ) ; } byte [ ] attr = new byte [ len + 2 ] ; attr [ 0 ] = VENDOR_SPECIFIC ; attr [ 1 ] = ( byte ) ( len + 2 ) ; System . arraycopy ( attrData , 0 , attr , 2 , len ) ; return attr ; }
Renders this attribute as a byte array.
Renders this attribute as a byte array .
// write vendor ID
 // write sub-attributes
 // occurs never
 // check data length
 // compose attribute
 // code
 // length
