code: private byte[] getData(List<byte[]> blocks, int length)
     {
        byte[] result;
  
        if (blocks.isEmpty() == false)
        {
           if (length < 4)
           {
              length = 4;
           }
  
           result = new byte[length];
           int offset = 0;
           byte[] data;
  
           while (offset < length)
           {
              data = blocks.remove(0);
              System.arraycopy(data, 0, result, offset, data.length);
              offset += data.length;
           }
        }
        else
        {
           result = null;
        }
  
        return (result);
     }
docs: Internal method used to retrieve a byte array from one
  or more embedded data blocks. Consecutive data blocks may
  need to be concatenated by this method in order to retrieve
  the complete set of data.
  
  @param blocks list of data blocks
  @param length expected length of the data
  @return byte array