tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kaab kaoutar" <kaa...@hotmail.com>
Subject URLConection and readfully failsHi
Date Fri, 01 Jun 2001 17:49:35 GMT

Hi
i use the follwing:

try {
         URL urlObject = new URL(url);
         URLConnection agent = urlObject.openConnection();
         DataInputStream input =
           new DataInputStream(agent.getInputStream());

and
the following code doesn't work
/*
         byte[] b = new byte[input.available 
()];//System.out.println(input.available());
         input.readFully (b);
         input.close ();//System.out.println(b.length);
         page=new String (b, 0, b.length);
         System.out.println(page);System.out.println("end");
         return page;
  */


but that one does!

while((nextLine = input.readLine()) != null) {
            page.append(nextLine+"\n");}
         input.close();
         return(page.toString());


aslong as reding line by line consumes time i'd like to use readfully! ho 
wto do it ? is there a more performent and speedy when to get the page ?
thanks
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Mime
View raw message