On 16 November 2011 11:21, ron simon <beachboy2...@googlemail.com> wrote:
> Hi Dev. Team,
> I want to create a spectral analyser but I'am new in this field . For
> writing a content from a music file in an array I used this
>
>        try {
>            File file = new File(mFileName,
> array_spinner[Getposition()]);
>             file.createNewFile();
>             InputStream  is = new FileInputStream (file);
>             BufferedInputStream     bis = new BufferedInputStream
> (is);
>                     DataInputStream         dis = new DataInputStream
> (bis);
>
>                    while (dis.available() > 0)
>                    {
>                        dis.read(buffer,byteOffset,byteCount);

Ron,

How big is your buffer? Where do you manage offset and byte count?

You don't check what values did DataInputStream.read() returned.

You have to do a bit more management in order to read the whole file
into a byte array. Just google for 'reading a whole file in Java' or
better still 'copying files in Java'. That should show you, what needs
doing around buffers, offsets etc.

-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to