Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11069

BufferedWriter cannot handle InterruptedIOException

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject BufferedWriter cannot handle InterruptedIOException
Date 2012-01-04 18:59 +0100
Organization albasani.net
Message-ID <je241r$pon$1@news.albasani.net> (permalink)

Show all headers | View raw


Dear All,

Just reading the spec of InterruptedIOException:

	"Signals that an I/O operation has been
	interrupted. An <code>InterruptedIOException</code>
	is thrown to indicate that an input or output
	transfer has been terminated because the thread
	performing it was interrupted. The field {@link
	#bytesTransferred} indicates how many bytes were
	successfully transferred before the interruption
	occurred."

But I think this does not carry over to BufferedOutputStream. I
find the following code there:

     /** Flush the internal buffer */
     private void flushBuffer() throws IOException {
         if (count > 0) {
             out.write(buf, 0, count);
             count = 0;
         }
     }

In case that out throws an InterruptedIOException exception,
the write operation is directly terminated, and the count
is not set to zero.

As an effect next time flushBuffer is called again, the
same bytes are written out again.

Some better BufferedOutputStream class known?

Bye

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

BufferedWriter cannot handle InterruptedIOException Jan Burse <janburse@fastmail.fm> - 2012-01-04 18:59 +0100
  Corr: BufferedOutputStream cannot handle InterruptedIOException Jan Burse <janburse@fastmail.fm> - 2012-01-04 19:00 +0100
  Re: BufferedWriter cannot handle InterruptedIOException Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-04 13:41 -0800
  Re: BufferedWriter cannot handle InterruptedIOException Tom Anderson <twic@urchin.earth.li> - 2012-01-08 14:12 +0000

csiph-web