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


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

Re: DataInputStream

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Wed, 05 Oct 2011 10:39:07 -0500
Date Wed, 05 Oct 2011 08:38:59 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows NT 5.2; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: DataInputStream
References <1418dd7f-d5d1-4a2c-b77b-87666f6a9591@k15g2000yqd.googlegroups.com> <9f2a8cFh1nU1@mid.individual.net> <6cf66421-77a9-4088-b810-3bcc958cc8ca@i28g2000yqn.googlegroups.com> <2ec7550a-a3d9-40a9-bca1-e1fd2586429d@g33g2000yqc.googlegroups.com> <02b9b80f-ff02-499d-8f33-056080b114bb@s9g2000yql.googlegroups.com>
In-Reply-To <02b9b80f-ff02-499d-8f33-056080b114bb@s9g2000yql.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <lbadnQCmK7CB5xHTnZ2dnUVZ_qydnZ2d@earthlink.com> (permalink)
Lines 22
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.200.54
X-Trace sv3-qedGFXIrQjXha5+8M7olQ4o2XvmVR25GsUux8NhoWh7h6YNZepy5pa7Q5HJ7rsULAN1SU7DNauJC3ex!8xSs9Wtk6I92ub/uFHHd9Jkjplm3SVBjjl2t9gBIV5NnwkfCzFi5nAaToJgmpONxjaelCYo+TL+1!DWA6nypc2LpTKN5yW9ZbaMztkEVXrwDTcB62aKizcTlLiA==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2193
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8572

Show key headers only | View raw


On 10/5/2011 7:17 AM, bob wrote:
> The issue is that it's too slow.
>
> What I'm hoping for is something like this:
>
> 			byte[] b = new byte[numfloats*4];
> 			dis.read(b, 0, numfloats*4);
> 			float[] f = (float[]) b;
> 			return f;
>
> I don't know why, but it won't let me do the cast.  Any ideas?

Perhaps because you used a Java compiler, rather than a C compiler.

In Java, there are no guarantees about how arrays are arranged in
memory, so a cast from byte[] to float[] would not have defined results.

If it remains too slow even with buffering, you may need to consider
alternative such as matlab, Fortran, or C. Java tends not to be the
fastest language for bulk operations on floating point data.

Patricia

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


Thread

DataInputStream bob <bob@coolgroups.com> - 2011-10-04 22:34 -0700
  Re: DataInputStream Robert Klemme <shortcutter@googlemail.com> - 2011-10-05 08:02 +0200
    Re: DataInputStream bob <bob@coolgroups.com> - 2011-10-04 23:17 -0700
      Re: DataInputStream Robert Klemme <shortcutter@googlemail.com> - 2011-10-05 00:07 -0700
        Re: DataInputStream bob <bob@coolgroups.com> - 2011-10-05 07:17 -0700
          Re: DataInputStream markspace <-@.> - 2011-10-05 08:27 -0700
          Re: DataInputStream Patricia Shanahan <pats@acm.org> - 2011-10-05 08:38 -0700
          Re: DataInputStream Robert Klemme <shortcutter@googlemail.com> - 2011-10-05 08:58 -0700
            Re: DataInputStream Lew <lewbloch@gmail.com> - 2011-10-05 14:52 -0700
              Re: DataInputStream Patricia Shanahan <pats@acm.org> - 2011-10-05 15:15 -0700
              Re: DataInputStream Robert Klemme <shortcutter@googlemail.com> - 2011-10-06 00:11 -0700
                Re: DataInputStream Lew <lewbloch@gmail.com> - 2011-10-06 07:08 -0700
                Re: DataInputStream Patricia Shanahan <pats@acm.org> - 2011-10-06 07:49 -0700
          Re: DataInputStream Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-05 21:16 -0400
      Re: DataInputStream Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-05 08:12 +0000
        Re: DataInputStream bob <bob@coolgroups.com> - 2011-10-05 07:12 -0700
  Re: DataInputStream Roedy Green <see_website@mindprod.com.invalid> - 2011-10-06 02:48 -0700

csiph-web