[android-developers] Re: Not able to write a file completely with fileinputstream and fileoutputstream?

2011-05-02 Thread Daniel Felix
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

[android-developers] Re: Not able to write a file completely with fileinputstream and fileoutputstream?

2011-05-02 Thread Bob Kerns
No, this is a bad idea. This consumes memory -- and for large files, it can consume more memory than you have. It is also completely unnecessary. The loop to do repeat over the buffer is just 3 lines of code, including the final '}'. That's actually easier than figuring out how big to make the

[android-developers] Re: Not able to write a file completely with fileinputstream and fileoutputstream?

2011-04-29 Thread DanH
Don't forget to close the output stream. On Apr 28, 11:29 pm, Vishwas Undre vishwas.un...@gmail.com wrote: Hi, use next code  FileOutputStream fileOutput = new FileOutputStream(filepath);  InputStream inputStream = urlConnection.getInputStream();  int[] key = {123,456};  int totalRead =

[android-developers] Re: Not able to write a file completely with fileinputstream and fileoutputstream?

2011-04-29 Thread DanH
You don't have to call flush for every write. You don't have to call flush at all. You do need to close the output stream, though. On Apr 28, 9:23 am, Daniel Drozdzewski daniel.drozdzew...@gmail.com wrote: Hitendrasinh, you have to call FileOutputStream.flush() after every write, but before