This might be helpful.
http://androidsnips.blogspot.com/2010/10/copying-larger-database-files-in.html



On Dec 12, 10:44 pm, Kristopher Micinski <[email protected]>
wrote:
> On Mon, Dec 12, 2011 at 11:44 AM, saex <[email protected]> wrote:
> > i need to open a file of 12 Megabytes, but actually i'm doing it
> > creating a buffer of 12834566-byte, because the size of the file is
> > 12MB
>
> > Then, i supose i have to read with blocks of 1024 Kbytes instead of
> > one block of 12 Mbytes, with a for, but i don't know how to do it, i
> > need a little help with it.
>
> > This is my actual code:
>
> > File f = new File(getCacheDir()+"/berlin.mp3");
> >        if (!f.exists()) try {
> >          InputStream is = getAssets().open("berlin.mp3");
> >          int size = is.available();
> >          byte[] buffer = new byte[size];
> >          is.read(buffer);
> >          is.close();
> >          FileOutputStream fos = new FileOutputStream(f);
> >          fos.write(buffer);
> >          fos.close();
> >        } catch (Exception e) { throw new RuntimeException(e); }
>
> > Please, can someone tell me what i have to thangue in this code to
> > read blocks of 1024 Kbytes instead of one block of 12 Mbytes?
>
> > THanks!
>
> http://docs.oracle.com/javase/1.4.2/docs/api/java/io/InputStream.html...[],
> int, int)

-- 
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

Reply via email to