🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #734

Re: a question about PrintWirter.

#734
From: John
Date: Thu, 28 Nov 2002 16:02
41 lines
2158 bytes
The PrintWriter is buffered.  It will only flush itself when println()
is called and autoFlush is turned on (true).  There is a method called
flush() in which you can do the flushing yourself.

John


On Tue, 26 Nov 2002 17:55:49 +0100, "Zhilei Ma" <zhilei.ma@iao.fhg.de>
wrote:

>Hello all,
>
>i habe wrote a code piece like the following:
>
>import java.io.*;
>
>public class PrintWriterDemo
>{
>    public static void main(String[] args) throws IOException
>    {
> PrintWriter pw = new PrintWriter(System.out, false);
> pw.println("this is a String.");
>
> int i=-7;
> pw.println(i);
>
> double d = 2.4e-7;
> pw.println(d);
>    }
>}
>
>when i run this programm, it output nothing, until i changed the parameter
>of the constructor of PrintWriter from "false" to "true". I know that the
>boolean paremeter means that "autoFlush - A boolean; if true, the println()
>methods will flush the output buffer". But i cann't good understand it. Can
>anyone explain it to me?
>
>Thanks a lot!
>
>Zhilei
>
Technical Details
Message-ID: <vbfcuuchaauvsrrppaia1ks1j81sg817q6@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!news-west.rr.com!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!twister.tampabay.rr.com.POSTED!53ab2750!not-for-mail
References: <3de3a784@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,ddacbbc68ab6ea40
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-11-28 08:04:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!news-west.rr.com!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!twister.tampabay.rr.com.POSTED!53ab2750!not-for-mail
From: John <cyllan@pobox.com>
Newsgroups: borland.public.jbuilder.java.api
Subject: Re: a question about PrintWirter.
Message-ID: <vbfcuuchaauvsrrppaia1ks1j81sg817q6@4ax.com>
References: <3de3a784@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.9/32.560
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 42
Date: Thu, 28 Nov 2002 16:02:24 GMT
NNTP-Posting-Host: 65.32.106.127
X-Complaints-To: abuse@rr.com
X-Trace: twister.tampabay.rr.com 1038499344 65.32.106.127 (Thu, 28 Nov 2002 11:02:24 EST)
NNTP-Posting-Date: Thu, 28 Nov 2002 11:02:24 EST
Organization: RoadRunner - Tampa Bay