The Artima Developer Community
Sponsored Link

Java Answers Forum
remote URL size from servlet

1 reply on 1 page. Most recent reply: Nov 13, 2003 1:27 AM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Peter Kellner

Posts: 10
Nickname: pkellner
Registered: Feb, 2002

remote URL size from servlet Posted: Nov 11, 2003 7:29 PM
Reply to this message Reply
Advertisement
I have a servlet that loads an image (jpg file) from another server. I'm trying to figure out how many bytes this jpg is. Below is a piece of my code that actually loads the image. Any clues on how to figure out how big the original jpg is would be appreciated.
            long beforeGetURL = java.lang.System.currentTimeMillis();
            String strSourceURL = new String("http://localhost/my.jpg");
 
            URL jpgURL = new URL(strSourceURL);
            ImageIcon ic = new ImageIcon(jpgURL);
            Image im = ic.getImage();
 
            long afterGetURL = java.lang.System.currentTimeMillis();
 
            fetchTimeInMilliSeconds = afterGetURL - beforeGetURL;


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: remote URL size from servlet Posted: Nov 13, 2003 1:27 AM
Reply to this message Reply
>> ImageIcon ic = new ImageIcon(jpgURL); >> Image im = ic.getImage();

Where do you get the ImageIcon and Image classes in Java API?

Flat View: This topic has 1 reply on 1 page
Topic: Socket Communication (Server and Client) Previous Topic   Next Topic Topic: New Programmer - Need help with assignemnt

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use