Hi, You should set a buffet size of file and then read it all in one time in that buffer. It will solved your problem. Once I was stuck such kind of problem and I tried different ways and finally I used NDK for it but my problem was not same I was trying to read a file from the server and have no idea what is the exact size of the file. The simple solution is buffer size of file type and read whole file in one time.
Yours, On Apr 28, 6:29 pm, Hitendrasinh Gohil <[email protected]> wrote: > hi, > > Below is my code that i am writing the file. > > FileOutputStream fileOutput = new FileOutputStream(filepath); > > InputStream inputStream = urlConnection.getInputStream(); > > int[] key = {123,456}; > > int totalRead = 0; > > int read = 0; > > > do > > { > > read = inputStream.read(buffer); > > > fileOutput.write(read ^ key[totalRead % (key.length-1)]); > > > totalRead+=read; > //totalRead++; > > > }while (read>0); > > i am able to write only some kbs from the inputstream. > > If i write the file byte by byte than it works but it takes to much > time. > like > read= inputStream.read(); > totalRead++; > > can anyone help me what is the problem with above code? > > regards, > hitendrasinh gohil -- 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

