关闭

下载

725人阅读 评论(0) 收藏 举报
Imports System.IO Imports System.Net Imports System.Text Class WebRetrieve Public Shared Sub Main() Dim wr As HttpWebRequest = CType(WebRequestFactory.Create("http://maps.weather.com/web/radar/us_orl_ultraradar_large_usen.jpg"), HttpWebRequest) Dim ws As HttpWebResponse = CType(wr.GetResponse, HttpWebResponse) Dim str As Stream = ws.GetResponseStream Dim inBuf(100000) As Byte Dim bytesToRead As Integer = CType(inBuf.Length, Integer) Dim bytesRead As Integer = 0 While bytesToRead > 0 Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead) If n = 0 Then ' break End If bytesRead += n bytesToRead -= n End While Dim fstr As FileStream = New FileStream("weather.jpg", FileMode.OpenOrCreate, FileAccess.Write) fstr.Write(inBuf, 0, bytesRead) str.Close fstr.Close End Sub End Class
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:7727次
    • 积分:96
    • 等级:
    • 排名:千里之外
    • 原创:2篇
    • 转载:6篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档