public byte[] encode(){
  char dataLength=getDataLength();
  char type=getAttributeType();
  byte binary[]=new byte[HEADER_LENGTH + dataLength + (padding ? ((4 - dataLength % 4) % 4) : 0)];
  binary[0]=(byte)(type >> 8);
  binary[1]=(byte)(type & 0x00FF);
  binary[2]=(byte)(dataLength >> 8);
  binary[3]=(byte)(dataLength & 0x00FF);
  System.arraycopy(data,0,binary,4,dataLength);
  return binary;
}

public byte [ ] encode ( ) { char dataLength = getDataLength ( ) ; char type = getAttributeType ( ) ; byte binary [ ] = new byte [ HEADER_LENGTH + dataLength + ( padding ? ( ( 4 - dataLength % 4 ) % 4 ) : 0 ) ] ; binary [ 0 ] = ( byte ) ( type > > 8 ) ; binary [ 1 ] = ( byte ) ( type & 0x00FF ) ; binary [ 2 ] = ( byte ) ( dataLength > > 8 ) ; binary [ 3 ] = ( byte ) ( dataLength & 0x00FF ) ; System . arraycopy ( data , 0 , binary , 4 , dataLength ) ; return binary ; }
returns a binary representation of this attribute .
