Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.util.Log;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Main {
    static public void copyDataBase() throws IOException {

        OutputStream databaseOutputStream = new FileOutputStream("/mnt/sdcard/jwdroid.db");
        InputStream databaseInputStream = new FileInputStream("/data/data/com.jwdroid/databases/jwdroid");

        byte[] buffer = new byte[1];
        int length;
        while ((length = databaseInputStream.read(buffer)) > 0) {
            databaseOutputStream.write(buffer);
            Log.w("Bytes: ", ((Integer) length).toString());
            Log.w("value", buffer.toString());
        }

        databaseOutputStream.flush();
        databaseOutputStream.close();
        databaseInputStream.close();
    }
}