From 21151b5411a46a02fb2b08aeac62cbcd5eb3025e Mon Sep 17 00:00:00 2001 From: Niki Hansche Date: Thu, 15 May 2014 18:09:51 +0200 Subject: [PATCH] Use standard 8k-buffer to copy databases The original implementation was doing an unbuffered bytewise copy. --- src/com/activeandroid/DatabaseHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/activeandroid/DatabaseHelper.java b/src/com/activeandroid/DatabaseHelper.java index cad7a896f..7158c5bb6 100644 --- a/src/com/activeandroid/DatabaseHelper.java +++ b/src/com/activeandroid/DatabaseHelper.java @@ -105,10 +105,10 @@ public void copyAttachedDatabase(Context context, String databaseName) { final InputStream inputStream = context.getAssets().open(databaseName); final OutputStream output = new FileOutputStream(dbPath); - byte[] buffer = new byte[1024]; + byte[] buffer = new byte[8192]; int length; - while ((length = inputStream.read(buffer)) > 0) { + while ((length = inputStream.read(buffer, 0, 8192)) > 0) { output.write(buffer, 0, length); }