MMapping it could be a solution.

On Aug 30, 12:13 pm, Mark Murphy <[email protected]> wrote:
> On Tue, Aug 30, 2011 at 6:02 AM, NaveenShrivastva
>
> <[email protected]> wrote:
> > i am trying to retrieve meta data from media file approx 1gb
>
> So? That does not mean you can allocate 1GB of memory.
>
> > File file = null;
> >        FileInputStream fis = null;
> >        byte fullData[] = null;
> >        byte requiredData[] = null;
> >        try{
> >                file = new File(fileName);
> >                fis = new FileInputStream(file);
> >                long  filelen=file.length();
>
> >                 System.out.print("File Length:"+filelen);
>
> >                fullData = new byte[ (int) filelen];
>
> You cannot do that for large files, as you will run out of memory. You
> will need to find your pattern by reading and analyzing smaller chunks
> of the file at a time (e.g., 1K).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
> Available!

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