代码:
public int mp3DownLoad(String urlName , String fileName , String path){
InputStream in = null;
try{
WirteTOSDcard wts = new WirteTOSDcard();
if(wts.isFileExists(fileName, path)){
return 0;
}else{
in = httpGet(urlName);
File fileResult = wts.wirteTOsd(fileName, path, in);
if(fileResult == null){
return -1;
}
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}finally{
try {
in.close(); //错误指向这一行,空指针异常。
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return 1;
}