You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by kaab kaoutar <ka...@hotmail.com> on 2001/06/01 19:49:35 UTC
URLConection and readfully failsHi
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.