如何成为Android开发高手
2010-08-31 00:43:00 来源:WEB开发网384
385}
386
387fileService.delete(this.downloadUrl);
388
389} catch (Exception e) {
390
391print(e.toString());
392
393throw new Exception("下载失败");
394
395}
396
397return this.downloadSize;
398
399}
400
401/**
402
403 * 获取Http响应头字段
404
405 * @param http
406
407 * @return
408
409 */
410
411public static Map
412
413Map
414
415for (int i = 0;; i++) {
416
417String mine = http.getHeaderField(i);
418
419if (mine == null) break;
420
421header.put(http.getHeaderFieldKey(i), mine);
422
423}
424
425return header;
426
427}
428
429/**
430
431 * 打印Http头字段
432
433 * @param http
434
435 */
436
437public static void printResponseHeader(HttpURLConnection http){
438
439Map
440
441for(Map.Entry
442
443String key = entry.getKey()!=null ? entry.getKey()+ ":" : "";
444
445print(key+ entry.getValue());
446
447}
448
449}
450
451
452
453private static void print(String msg){
更多精彩
赞助商链接