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

推荐订阅源

The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
O
OpenAI News
NISL@THU
NISL@THU
AI
AI
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
W
WeLiveSecurity
P
Privacy International News Feed
Cisco Talos Blog
Cisco Talos Blog
S
Secure Thoughts
D
Docker
博客园 - 三生石上(FineUI控件)
T
Troy Hunt's Blog
T
Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
H
Hacker News: Front Page
B
Blog
S
SegmentFault 最新的问题
H
Heimdal Security Blog
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
小众软件
小众软件
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
Hacker News: Ask HN
Hacker News: Ask HN
Recent Announcements
Recent Announcements
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
PCI Perspectives
PCI Perspectives
I
Intezer
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed

博客园 - 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();
}
 
}
}