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


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

BufferedWriter cannot handle InterruptedIOException

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject BufferedWriter cannot handle InterruptedIOException
Date Wed, 04 Jan 2012 18:59:18 +0100
Organization albasani.net
Lines 34
Message-ID <je241r$pon$1@news.albasani.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net C7c3MV2r47FSE3CNkscmpfp30blJZeqhmwjV230oJySbua5VySYwL6cIPOyADJhFF4Kj+qV8apv3PtrJI0G4V3ZgEW27OSPp3e/TnxnXQnH9okvSJKpbOcYk1AuLruXD
NNTP-Posting-Date Wed, 4 Jan 2012 17:59:23 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="SB5rcW/zRgAP6mNh8WfjOaSgnuaHZGAaQQcTkEms3UPzynAMIWNU2IR+AlyImr0NA1eNs/pdMdmntvz3XIxsq8DFPnw/0Pvf0SAd6UR8beTe0zX1Bj36RK0n77VlWXvh"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20111121 Firefox/8.0.1 SeaMonkey/2.5
Cancel-Lock sha1:GgNif7QfVgJgK99yEXCt+c3w/MI=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11069

Show key headers only | 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