Skip to content

Commit

Permalink
Use standard 8k-buffer to copy databases
Browse files Browse the repository at this point in the history
The original implementation was doing an unbuffered bytewise copy.
  • Loading branch information
vonloxley committed May 16, 2014
1 parent 12c6937 commit 21151b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/com/activeandroid/DatabaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 21151b5

Please sign in to comment.