Can't you just use an InputStreamReader wrapping around your InputStream? Like so:
char[] cBuffer = new char[1000000]; InputStreamReader reader = new InputStreamReader(dInStream); numBytesRead = reader.read(cBuffer); The problem with ByteBuffers is that they are only meant to hold data temporarily, and it sounds like you'd be reading a large byte array in, then converting to a large char-array which isn't pretty. On Sep 2, 12:18 pm, WoodManEXP <[email protected]> wrote: > Hi Dmitry, > > Thank you for responding. The chars I’d like to read are two byte > chars (they really are an array of ushorts, but the java char type > represents them OK). > > As far as I can tell there is simply no way in Java to implement a > seemingly obvious sequence of statements like: > > char[] cBuffer = new char[1000000]; > numBytesRead = dInStream.read(cBuffer); > > The java.io classes will read only byte[] arrays or will read only one > char element at the time (painfully slow). The facilities for > converting the byte[] array to any other data types (java.nio stuff) > are painfully slow as well. > > One suggestion has been to use JNI (NDK in Android lingo). Jeeze, what > a convoluted mess that is… But I’m going to look into it to write a > native function to do the read or maybe cast a short[] to a byte[] to > fool the java.io read method. > > If anyone can share any ideas that will be great. > > Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

