Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8592
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!5g2000yqo.googlegroups.com!not-for-mail |
|---|---|
| From | bob <bob@coolgroups.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: optional operation |
| Date | Wed, 5 Oct 2011 23:46:11 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 59 |
| Message-ID | <a1d9260d-6f6f-456c-a49c-ae8a0bfd2c9a@5g2000yqo.googlegroups.com> (permalink) |
| References | <5eb0fcba-199f-46e4-b913-2f3e851d89fc@q26g2000vby.googlegroups.com> <c_idnaoeDvisCRHTnZ2dnUVZ_rWdnZ2d@earthlink.com> <6745899f-3c13-4d2b-81fb-52975c560a3b@q24g2000vby.googlegroups.com> <j6in1n$fil$1@dont-email.me> <j6inr7$jms$1@dont-email.me> |
| 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 1317887388 32418 127.0.0.1 (6 Oct 2011 07:49:48 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Thu, 6 Oct 2011 07:49:48 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | 5g2000yqo.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:8592 |
Show key headers only | View raw
Here's what I tried: AssetManager am = this.getResources().getAssets(); AssetFileDescriptor afd = am.openFd(filename); FileInputStream fis = afd.createInputStream(); FileChannel fchan = fis.getChannel(); ByteBuffer inBuff = ByteBuffer.allocateDirect( 24121*4 ); int bytesread = fchan.read( inBuff ); FloatBuffer floatBuffer = inBuff.asFloatBuffer(); float[] floats = new float[ 24121 ]; floatBuffer.get( floats); return floats; However, I always get a BufferUnderflowException at floatBuffer.get( floats); 10-05 23:37:07.400: ERROR/AndroidRuntime(3570): Caused by: java.nio.BufferUnderflowException For some reason, floatBuffer thinks it has a capacity of 0 after it's created. Any ideas? On Oct 5, 6:05 pm, markspace <-@.> wrote: > On 10/5/2011 3:51 PM, markspace wrote: > > > On 10/5/2011 2:20 PM, bob wrote: > >> Thanks, but I am still confused. How can a buffer not be backed by an > >> accessible array? > > > I would have guessed due to this method here: > > > <http://download.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html...> > > > You'll need to read the comments at the begging of that page to > > understand what it is doing. > > Should be "beginning" not begging. Typing fast, didn't proofread. > > Meant to add too that you seemed to have discovered another reason that > the array would not be accessible --- the Buffer wraps another buffer, > which is fine.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
optional operation bob <bob@coolgroups.com> - 2011-10-05 09:49 -0700
Re: optional operation Patricia Shanahan <pats@acm.org> - 2011-10-05 10:30 -0700
Re: optional operation bob <bob@coolgroups.com> - 2011-10-05 14:20 -0700
Re: optional operation markspace <-@.> - 2011-10-05 15:51 -0700
Re: optional operation markspace <-@.> - 2011-10-05 16:05 -0700
Re: optional operation bob <bob@coolgroups.com> - 2011-10-05 23:46 -0700
Re: optional operation Lew <lewbloch@gmail.com> - 2011-10-06 06:47 -0700
csiph-web