Size


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Size

  1. #1
    Join Date
    Oct 2004
    Posts
    151

    Question 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  2. #2
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    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.

  3. #3
    Join Date
    Oct 2004
    Posts
    151

    Question

    Hi everyone,

    Quote 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  4. #4
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    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.

  5. #5
    Join Date
    Oct 2004
    Posts
    151

    Thumbs up

    Hi everyone,

    Quote 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  6. #6
    Join Date
    Aug 2005
    Posts
    14
    Quote 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

  7. #7
    Join Date
    Oct 2004
    Posts
    151
    Hi,

    Can you stop this **** and stop hijacking other peoples threads

    Richard West
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

Similar Threads

  1. Problem with changing paper size in VB6+WinXP
    By kdotb in forum VB Classic
    Replies: 0
    Last Post: 08-08-2005, 01:59 PM
  2. About the corr. paper size of the report
    By Edwardc in forum VB Classic
    Replies: 0
    Last Post: 05-20-2005, 12:07 AM
  3. Replies: 2
    Last Post: 03-07-2001, 08:25 PM
  4. Font Size
    By Roe in forum Web
    Replies: 5
    Last Post: 12-28-2000, 03:28 AM
  5. Font Size
    By dewa in forum Web
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center