Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!s9g2000yql.googlegroups.com!not-for-mail From: bob Newsgroups: comp.lang.java.programmer Subject: Re: DataInputStream Date: Wed, 5 Oct 2011 07:17:10 -0700 (PDT) Organization: http://groups.google.com Lines: 60 Message-ID: <02b9b80f-ff02-499d-8f33-056080b114bb@s9g2000yql.googlegroups.com> 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> NNTP-Posting-Host: 99.152.153.161 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1317824230 23441 127.0.0.1 (5 Oct 2011 14:17:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 5 Oct 2011 14:17:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s9g2000yql.googlegroups.com; posting-host=99.152.153.161; posting-account=v1lx5wkAAAALWYfGBkwkMb2guPF9cW2u User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8570 The issue is that it's too slow. What I'm hoping for is something like this: byte[] b =3D new byte[numfloats*4]; dis.read(b, 0, numfloats*4); float[] f =3D (float[]) b; return f; I don't know why, but it won't let me do the cast. Any ideas? On Oct 5, 2:07=A0am, Robert Klemme wrote: > On Oct 5, 8:17=A0am, bob wrote: > > > > > > > > > > > =A0 =A0 =A0 =A0 float[] getVertices3(String filename) { > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 try { > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 AssetManager am =3D thi= s.getResources().getAssets(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputStream is =3D am.o= pen(filename); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 DataInputStream dis =3D= new DataInputStream(is); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int numfloats=3Ddis.rea= dInt(); > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 float[] floatArray =3D = new float[numfloats]; > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (int ctr =3D 0; ctr= < floatArray.length; ctr++) { > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 floatAr= ray[ctr] =3D dis.readFloat(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return floatArray; > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } catch (IOException e) { > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 e.printStackTrace(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return null; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > > > =A0 =A0 =A0 =A0 } > > That's OK. =A0Now, what's the issue? > > Cheers > > robert