Since LineNumberReader is a subclass of BufferedReader, you're actually
double-buffering your data, which is probably slowing things down and
chewing up unnecessary amounts of memory.  Try not using the
BufferedInputStream.
    (*Chris*)

----- Original Message -----
From: Peter Blakeley <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 06, 1999 3:28 PM
Subject: Re: WebSpider, printing the contents of an URL


> This works for me pb... ;-})
>
> public final class TNet {
>
>         /**
>         Usage:
>         StringBuffer result = TNet.readURL(new
> URL("your.host.com/index.html"));
>         */
>     public final static StringBuffer readURL(URL url)
>         throws MalformedURLException, IOException
>     {
>         StringBuffer res = new StringBuffer();
>         // InputStream in = url.openStream();
>         LineNumberReader lreader = new LineNumberReader(
>             new InputStreamReader(
>             new java.io.BufferedInputStream(url.openStream())));
>         String tmp = null;
>         while((tmp = lreader.readLine())!= null) {
>             res.append(tmp);
>             res.append("\n");
>
>         }
>         lreader.close();
>         return res;
>     }
> }
>
>
> Ravachol Pereira wrote:
> >
> > Hi,
> >
> > I am lost in the jungle of urls, urlstreamhandlers and
contenthandlerfactories.
> > What I am trying to do is simply to get the contents of an url (the
html) and
> > printing it.
> >
> > If anyone has done this before, please send me some sample code.
> >
> > This is how far I've gotten:
> > ===
> > URL url = new URL(urlname);
> >
> > URLConnection conn = url.openConnection();
> >
> > conn.connect();
> >
> > String mime = conn.getContentType();
> >
> > ===
> >
> >
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> --
> Peter Blakeley
> Head of Software Development Coolcat Software Pty. Ltd.
> http://www.coolcat.com.au/
> Director Bug Audit Services
> http://www.coolcat.com.au/bug_audit
>
>
> A financial instrument is a device used by a Banker to pick your pocket.
> It is said an art degree is a licence to know it all, I am lucky I need
> no art degree.
> ;-})
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to