Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9691
| Date | 2011-11-06 17:48 -0500 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| 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> |
| Message-ID | <4eb70ea5$0$287$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 10/5/2011 10:17 AM, bob wrote:
> On Oct 5, 2:07 am, Robert Klemme<shortcut...@googlemail.com> wrote:
>> On Oct 5, 8:17 am, bob<b...@coolgroups.com> wrote:
>>> float[] getVertices3(String filename) {
>>
>>> try {
>>> AssetManager am = this.getResources().getAssets();
>>> InputStream is = am.open(filename);
>>> DataInputStream dis = new DataInputStream(is);
>>> int numfloats=dis.readInt();
>>
>>> float[] floatArray = new float[numfloats];
>>
>>> for (int ctr = 0; ctr< floatArray.length; ctr++) {
>>> floatArray[ctr] = dis.readFloat();
>>> }
>>> return floatArray;
>>
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> return null;
>>> }
>>
>>> }
>>
>> That's OK. Now, what's the issue?
> The issue is that it's too slow.
Rather unlikely that readFloat is the culprit.
Try replace:
InputStream is = am.open(filename);
DataInputStream dis = new DataInputStream(is);
with:
InputStream is = new BufferedInputStream(am.open(filename), 65536);
DataInputStream dis = new DataInputStream(is);
Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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 Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 17:48 -0500
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