在学习编程的过程中,我觉得不止要获得课本的知识,更多的是通过学习技术知识提高解决问题的能力,这样我们才能走在最前方,更多Java学习,请搜索疯狂Java;
public static void saveUrlAs(String Url,File fileName){
//此方法只能用HTTP协议
//保存文件到本地
//Url是文件下载地址,fileName为一个全名(路径+文件名)文件
URL url;
DataOutputStream out = null;
DataInputStream in = null;
try {
url = new URL(Url);
HttpURLConnection connection =(HttpURLConnection) url.openConnection();
in = newDataInputStream(connection.getInputStream());
out = new DataOutputStream(new FileOutputStream(fileName));
byte[] buffer = new byte[4096];
int count = 0;
while ((count = in.read(buffer)) > 0) {
out.write(buffer, 0, count);
}
}catch (Exception e) {
e.printStackTrace();
}finally{
try {
if(out != null){
out.close();
}
if(in != null){
in.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
疯狂Java培训fkjava的课程采用针对性培养,全面提升学员就业能力,重点加强训练职业素质。老师辛勤的讲解,让学员充分感受Java的魅力,充分激发每个学员对于编程的热爱,让学员在半年的时间内掌握8-10万的代码量,成为真正的技术高手,疯狂Java采用企业全真模拟开发训练,迅速积累项目经验。让学员迅速获得其他人需要花费两年才能获得的工作技能,无忧就业!