-
Size
Hi everyone,
I have a really silly question but please bear with me for a while.
If say i connect to the url http://www.yahoo.com/a.zip
using the URLConnection how do i get the size of the above file in bytes assuming the connection is successfull?
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West
-
The server should put the length in a HTTP response header file: Content-Length:
Look at the the methods for the URLConnection class. One of those gets the content length for you.
BTW If you'd read the documentation first you could get the answer quicker.
-
Hi everyone,
 Originally Posted by Norm
Look at the the methods for the URLConnection class. One of those gets the content length for you.
I saw the documentation and i know you are talking about
getContentLength(). The thing is that it returns an int. What if it is a huge zip file, would not a long be better. Another thing is the length format that it returns was not specified(ie. whether its in bytes, kilobytes or megabytes)
that's why i am confused.
Do you know the format it returns?
Richard West
-
bytes.
Have you tried to download a HUGH file with a browser? What does it do?
I'm on a slow connection, bigger than 50M takes hours and hours!
I really doubt that any file you want to download can be over a billion bytes!
Do you know how large a number can be held in an int?
If so, there is something wrong with your design.
-
Hi everyone,
 Originally Posted by Norm
bytes.
Do you know how large a number can be held in an int?
You are right norm. I don't know why that didn't cross my mind. I must really be stupid
Thanks norm for your help and its been a pleasure conversing with you
If only the world have more people like you this world would be a great place
Richard West
-
 Originally Posted by freesoft_2000
Hi everyone,
You are right norm. I don't know why that didn't cross my mind. I must really be stupid
Thanks norm for your help and its been a pleasure conversing with you
If only the world have more people like you this world would be a great place
Richard West
Another example of site cross posting
http://forum.java.sun.com/thread.jsp...sageID=3840440
-
Hi,
Can you stop this **** and stop hijacking other peoples threads
Richard West
Similar Threads
-
By kdotb in forum VB Classic
Replies: 0
Last Post: 08-08-2005, 01:59 PM
-
By Edwardc in forum VB Classic
Replies: 0
Last Post: 05-20-2005, 12:07 AM
-
By newToJava in forum Java
Replies: 2
Last Post: 03-07-2001, 08:25 PM
-
Replies: 5
Last Post: 12-28-2000, 03:28 AM
-
Replies: 0
Last Post: 12-13-2000, 09:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|