惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
Cloudbric
Cloudbric
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Security @ Cisco Blogs
月光博客
月光博客
T
Troy Hunt's Blog
H
Help Net Security
Forbes - Security
Forbes - Security
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
L
LINUX DO - 最新话题
Hacker News - Newest:
Hacker News - Newest: "LLM"
GbyAI
GbyAI
S
Schneier on Security
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
N
News | PayPal Newsroom
F
Fortinet All Blogs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
博客园_首页
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
O
OpenAI News
I
Intezer
S
Security Affairs
罗磊的独立博客
T
Tailwind CSS Blog
小众软件
小众软件
P
Palo Alto Networks Blog
Help Net Security
Help Net Security
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
F
Full Disclosure
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 聂微东
博客园 - 司徒正美
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
C
Cisco Blogs
Security Latest
Security Latest

博客园 - Jeff

4个月 C++ 有限状态机 POJ1019 POJ1035 POJ1007 POJ1005 ONLINE_JUDGE Linux shell定时器 怪异的grep结果 C primer笔记 Vxworks增加system call C语言常用宏定义技巧 分苹果 Socket 为什么选择SMP而不是AMP RTP memory in Vxworks Windriver的项目类型 RTP affinity Symmetric multiprocessing (SMP)
URL2FILE
Jeff · 2011-12-08 · via 博客园 - Jeff

2011-12-08 16:59  Jeff  阅读(1052)  评论()    收藏  举报

URL2File is a free Java application able to retrieve and save the content of a given URL to a local file. URL2File Java console-mode application can be used by itself or within a shell script to retrieve the content of an HTML document or other file from a remote Internet server to a local file.A typical example would be to write a shell script, such as a Windows command prompt BATch file, to download multiple files. Once the Java VM is successfully installed, copy URL2File.class to a directory of your choice and run it using the following syntax: java URL2File

伤不起,这个不是开源的?找不到源代码. 具体JAVA code的实现可以如下:
 
import java.net.*;
import java.io.*;
class url2file{
public static void main(String args[])throws IOException
{
int num1;
num1=1;
File fi3=new File(args[1]);
RandomAccessFile fi4=new RandomAccessFile(fi3,"rw");
URL urll=null;
try{
        urll=new URL(args[0]);
        DataInputStream dis;
        dis = new DataInputStream(urll.openStream());
        while((num1=dis.read())!=-1)
        {
                fi4.write((char)num1);
        }
        fi4.close();
        dis.close();
}
catch(MalformedURLException e)
{
        System.out.println(e);
        fi4.close();
}
catch(IOException e)
{
        System.out.println(e);
        fi4.close();
}
 
}
}