How to customize download filename? Drupal version: 7.14

Currently drupal save the downloaded filename as the last part of the URL, just like a file link "http://example.com/system/files/abc.txt", the default saved filename is "abc.txt".

I want to ask is how to change "abc.txt" to other filename such as "xyz.txt" while downloading.
For this issue there's a prerequisite,that is, your download method must be 'private', otherwise there's no chance for drupal to call your 'hook_file_download', it's important!

Here's an example from drupal's file module, change $file->filename to what you want, then return to HTTP headers.

/**
 * Implements hook_file_download().
 *
 * This function takes an extra parameter $field_type so that it may
 * be re-used by other File-like modules, such as Image.
 */  


  function file_file_download($uri, $field_type = 'file') {
     global $user;
     // Get the file record based on the URI. If not in the database just return.
     $files = file_load_multiple(array(), array('uri' => $uri));
     if (count($files)) {
         foreach ($files as $item) {
         // Since some database servers sometimes use a case-insensitive comparison
         // by default, double check that the filename is an exact match.
         if ($item->uri === $uri) {
             $file = $item;
             break;
         }
      }
   }
   if (!isset($file)) {
     return;
   }  
  
  //...........................other codes.........................  
  
  // Access specifically denied.
   if ($denied) {
     return -1;
   }  
  
  // Access is granted.
   $headers = file_get_content_headers($file);
   return $headers;
  }