BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   FileConnection fails after several iterations. (http://www.blackberryforums.com/developer-forum/219523-fileconnection-fails-after-several-iterations.html)

kmikedo 02-12-2010 03:49 PM

FileConnection fails after several iterations.
 
I wrote a program that periodically(every minute) receives updated data from server. Once the data is received it overwrites to the corresponding line of the file. ( code below )
Code below runs fine for first few iterations but throws IOException after.

Thanks.

try{
byte[] contents = bout.toByteArray(); // it always has fresh data.
conn = (FileConnection)Connector.open("file:///SDCard/update.txt");
if(!conn.exists())
conn.create();
out = conn.openOutputStream(index*rowSize);
out.write(contents);
}
finally{
if(conn!=null)
conn.close();
if(out!=null)
out.close();
}


All times are GMT -5. The time now is 06:07 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.