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


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

Re: Buffered reading seems to corrupt data stream

Date 2011-11-06 18:23 -0500
From Arne Vajhøj <arne@vajhoej.dk>
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> <bpGdnWtFWejMshbTnZ2dnUVZ_tOdnZ2d@posted.palinacquisition>
Message-ID <4eb716f1$0$283$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 10/4/2011 12:07 PM, Peter Duniho wrote:
> 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.

Really?

The code posted (excl. debug print was):

final DataInputStream dis = new DataInputStream(new 
BufferedInputStream(is));
final int size = dis.readInt();
final byte[] bytes = new byte[size];
dis.readFully(bytes);

It seems rather obvious to me that a new BufferedInputStream
would be created every time this code is called.

Arne

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


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 Silvio Bierman <silvio@moc.com> - 2011-11-07 11:00 +0100
  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
        Re: Buffered reading seems to corrupt data stream Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 18:23 -0500
          Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-11-06 16:03 -0800
            Re: Buffered reading seems to corrupt data stream Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 19:46 -0500
              Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-11-06 17:35 -0800
                Re: Buffered reading seems to corrupt data stream Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 21:16 -0500
                Re: Buffered reading seems to corrupt data stream Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-11-06 18:30 -0800
                Re: Buffered reading seems to corrupt data stream Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 21:50 -0500

csiph-web