SPL Array - Combine byte[] arrays


1. Available Util functions to combine byte[] arrays
  1. You should use Util functions to combine arrays.

 



2. Combine byte[] arrays
  1. You can combine byte[] arrays by using below method.

       Util.CombineArrays(byte[] src1, byte[] src2)

  2. Add script as follows.

      
    clear
    
    srcArr1 = Util.CreateArrayByte(2)
    srcArr1[0] = 0x40
    srcArr1[1] = 0x41
    
    srcArr2 = Util.CreateArrayByte(2)
    srcArr2[0] = 0xA0
    srcArr2[1] = 0xA1
    
    combArr = Util.CombineArrays(srcArr1, srcArr2)  
    
    print Util.BytesToHex(combArr)
    
      


  3. Executed result is as follows.




3. Combine range of byte[] arrays
  1. You can combine range of byte[] arrays by using below method.

       Util.CombineArrays(byte[] src1, int offset1, int count1, byte[] src2, int offset2, int count2)

  2. Add script as follows.

      
    clear
    
    srcArr1 = Util.CreateArrayByte(4)
    srcArr1[0] = 0x40
    srcArr1[1] = 0x41
    srcArr1[2] = 0x42
    srcArr1[3] = 0x43
    
    srcArr2 = Util.CreateArrayByte(4)
    srcArr2[0] = 0xA0
    srcArr2[1] = 0xA1
    srcArr2[2] = 0xA2
    srcArr2[3] = 0xA3
    
    combArr = Util.CombineArrays(srcArr1, 1, 2, srcArr2, 1, 2)  
    
    print Util.BytesToHex(combArr)
    
      


  3. Executed result is as follows.