You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Oliver Andrich <fi...@geekgoth.de> on 2004/05/26 22:07:25 UTC

Readers in common net NNTP package

Hi everybody,

I am toying around with an NNTPClient to retrieve some news articles for 
further processing, and I did some benchmarking. May I have some mis 
conceptions or missing out something completely, but basically I do

        Reader reader = this.nntpClient.retrieveArticleInfo(start, end);

        System.out.println(new Date());
        StringBuffer sb = new StringBuffer();
        char[] b = new char[1024];
        int n=0;
        while ((n = reader.read(b)) > 0) {
            // sb.append(b, 0, n);
        }
        System.out.println(new Date());

And this takes about 40 seconds, if start and end are about 20.000 
apart. So, I have a simple question, after the call to 
NNTPClient.retrieveArticle is the complete XOVR information already 
transmitted to the client, or is it read when I access the reader? The 
later would be a sufficient information for the performance difference 
compared to a StringReader which is based on a String containing 30.000 
"lines" (read it as 30.000 \n terminated Strings concatenated to one 
string).

If someone can comment on this and may be show me, how I can get the job 
done faster, then I would be more than happy. The reason why I like to 
tweak it, is that I like to present the information to the user for 
further selection. He can choose which articles to process and save.

My application is not a news reader, but it is some kind of retrieval 
program for fetching recipes from a cooking newsgroup.

Best regards,
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org