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


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

Re: Buffered reading seems to corrupt data stream

Date 2011-10-04 09:07 -0700
From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Newsgroups comp.lang.java.programmer
Subject Re: Buffered reading seems to corrupt data stream
References <y4Cdne-uvN4kUBTTnZ2dnUVZ_hWdnZ2d@westnet.com.au> <j6cv50$2fk$2@dont-email.me> <19587162.2005.1317743300210.JavaMail.geo-discussion-forums@prfh23>
Message-ID <bpGdnWtFWejMshbTnZ2dnUVZ_tOdnZ2d@posted.palinacquisition> (permalink)

Show all headers | View raw


On 10/4/11 8:48 AM, Lew wrote:
> Just this once the question was answerable (and answered, elsethread) without the SSCCE [...]

By that standard, _all_ questions are answerable without an SSCCE.  A 
person attempting an answer can always make a guess, and that guess 
always has a non-zero probability of being correct.

It was not possible from the code posted to _know_ that the OP was 
actually recreating the BufferedInputStream anew each time.  One could 
certainly guess, and of course Ronny did (and did so correctly, as it 
turns out).

But without an SSCCE, we know that the code posted deviates from the 
_actual_ code in some way, and it could just as easily have been that 
part of the deviation included an oversimplification of how 
BufferedInputStream was used.

Other guesses were made as well (i.e. my own), based on the same 
incomplete information, and they were wrong.  The guess that 
BufferedInputStream was being recreated each time could have been wrong 
too, since the code posted was obviously not really the code the OP was 
using.

That guess turned out to be right, and I give all credit to Ronny for 
taking the code at face value and making the guess he did.  He succeeded 
where at least some of the rest of us failed.  But there was no 
assurance at all that would have happened (*)

An SSCCE isn't just a good idea; it's a practical requirement.

Pete


(*)  One of the problems is that we all approach such questions with our 
own biases and experiences.  In my own case, I just assumed that the OP 
had left out the loop structures showing where BufferedInputStream was 
being created outside the loop, because who in their right mind would 
discard previously buffered data before they'd had a chance to read it?

Of course, that turned out to be exactly the problem, and it was my own 
blind spot that prevented me from considering that as a possibility. 
But we all have our blind spots.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 01:58 +1100
  Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 02:26 +1100
    Re: Buffered reading seems to corrupt data stream Ronny Schütz <usenet.r96@gishpuppy.com> - 2011-10-03 17:54 +0200
      Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 07:07 +1100
        Re: Buffered reading seems to corrupt data stream Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-03 13:18 -0700
      Re: Buffered reading seems to corrupt data stream "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-10-04 10:54 +1100
    Re: Buffered reading seems to corrupt data stream Roedy Green <see_website@mindprod.com.invalid> - 2011-10-03 11:46 -0700
  Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-03 08:44 -0700
  Re: Buffered reading seems to corrupt data stream markspace <-@.> - 2011-10-03 11:33 -0700
    Re: Buffered reading seems to corrupt data stream Lew <lewbloch@gmail.com> - 2011-10-04 08:48 -0700
      Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-04 09:07 -0700
        Re: Buffered reading seems to corrupt data stream Lew <lewbloch@gmail.com> - 2011-10-04 12:06 -0700

csiph-web