make saveDict return false if aborts the download. (Not used yet.)

This commit is contained in:
Andy2 2011-03-03 05:38:45 -08:00
parent ce61427bba
commit 1ca8ce9192

View file

@ -456,8 +456,9 @@ public class GameUtils {
return bytes; return bytes;
} }
public static void saveDict( Context context, String name, InputStream in ) public static boolean saveDict( Context context, String name, InputStream in )
{ {
boolean success = false;
try { try {
FileOutputStream fos = context.openFileOutput( name, FileOutputStream fos = context.openFileOutput( name,
Context.MODE_PRIVATE ); Context.MODE_PRIVATE );
@ -467,12 +468,14 @@ public class GameUtils {
fos.write( buf, 0, nRead ); fos.write( buf, 0, nRead );
} }
fos.close(); fos.close();
success = true;
} catch ( java.io.FileNotFoundException fnf ) { } catch ( java.io.FileNotFoundException fnf ) {
Utils.logf( "saveDict: FileNotFoundException: %s", fnf.toString() ); Utils.logf( "saveDict: FileNotFoundException: %s", fnf.toString() );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
Utils.logf( "saveDict: IOException: %s", ioe.toString() ); Utils.logf( "saveDict: IOException: %s", ioe.toString() );
deleteDict( context, name ); deleteDict( context, name );
} }
return success;
} }
private static boolean isGame( String file ) private static boolean isGame( String file )