Re: System.out PrintWriter print() and flush() not flushing?
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 20:54:37 -0800
Karsten Wutzke wrote:
Hello!
I have a thread that listens to a server socket. When a message
arrives, I print it via
System.out.println("...");
While the program is listening and not receiving a message I simply
want to print one dot "." so the user can see the program is still
listening. However, the dots are not printed, they only appear after
another call to println(). I also call flush() after print but it
doesn't flush the buffer.
Does anyone know how to print only a dot without a newline? How?
Karsten
Are you trying to read from the console too? If that is the case I think you will be unsuccessful.
From the docs for PrintWriter
"Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the println, printf, or format methods is invoked, rather than whenever a newline character happens to be output. These methods use the platform's own notion of line separator rather than the newline character."
This could be part of the problem too. Maybe it would be better to use PrintStream rather than PrintWriter.
--
Knute Johnson
email s/nospam/knute/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
.
- Follow-Ups:
- Re: System.out PrintWriter print() and flush() not flushing?
- From: Karsten Wutzke
- Re: System.out PrintWriter print() and flush() not flushing?
- References:
- System.out PrintWriter print() and flush() not flushing?
- From: Karsten Wutzke
- System.out PrintWriter print() and flush() not flushing?
- Prev by Date: System.out PrintWriter print() and flush() not flushing?
- Next by Date: Re: System.out PrintWriter print() and flush() not flushing?
- Previous by thread: System.out PrintWriter print() and flush() not flushing?
- Next by thread: Re: System.out PrintWriter print() and flush() not flushing?
- Index(es):
Relevant Pages
|
|