• Post Reply Bookmark Topic Watch Topic
  • New Topic

PrintWriter and BufferedWriter

 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have this method in my code that i wrote to send a message to clients. Now if i change the code to use PrintWriter it says that print writer with every println() method is flushing the buffer it doesn't WORK . i tried everything nothing happends. Now i try to use BufferedWriter same story. I use flush method to flush it nothing happends. I used to specify a buffer size trying to limit it to the length of the string and then flush it again nothing happends. What do i do wrong ? Code is below. The only way it flushes is only when the buffer get's overloaded.
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well it drove me nuts but i got it solved. Not that it was something hard to do but just overlooked HttpServletResponse object which has bufferFlush method. When dealing with more then one Stream it gets tied. I tried to flush on my stream that i get from one of the Server classes which ofcouse didnt' do anything instead must have used HttpServletResponse object. So i post this message just incase someone runs into this.
Thanks and bye
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!