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

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

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