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 at
http://groups.google.com/group/android-developers?hl=en

Reply via email to