It looks like there are a lot of things wrong with this code but have
you thought of logging the values of start and end immediately before
the statement that crashes the program?   This isn't really an Android
question, by the way.

On Apr 18, 10:41 pm, "pramod.deore" <deore.pramo...@gmail.com> wrote:
> hello everybody, I am developing one application in that I am reading
> one file in parts (I am reading 102400 bytes at a time ) and sending
> it to server. size of file is more than 5mb. I had write following
> method to read the file
>
>  public void readFile()
>      {
>           try
>           {
>               int size = (int)myFile.length();
>               noOfChunks = (size/102400);
>               noOfChunks = noOfChunks+1;
>               System.out.println ("size of file is "+size);
>
>               System.out.println ("size is"+noOfChunks);
>               FileInputStream fstream = new FileInputStream(myFile);
>
>               DataInputStream in = new DataInputStream(fstream);
>
>               byte[] byteArray = new byte[102400];
>
>               for (int i=1;i!=noOfChunks;i++)
>               {
>
>                   xyz = in.skip(start);
>
>                   System.out.println ("skipped :"+start);
>
>                   in.readFully(byteArray, start, end);//[b]This is
> line no 133 here exception occurs[/b]
>
>                   str = new String(byteArray);
>                   sendData("0213456789_A~addressbook.txt~10~"+str);
>                   start = end;
>                   end = end+102398;
>               }
>
>           }
>           catch (IOException ioe)
>           {
>               ioe.printStackTrace();
>           }
>      }
>
> But when this method throws IndexOutOfboundException at line 133.
> Actually I thought because of "in.readFully(byteArray, start, end);
> "
> It reads from start to end and store it to byteArray, but it is not
> working like that.
>
> Anybody knows what I am doing wrong?
>
> Thanks
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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