Skip to main content

Vincent Tsao's Library tagged database   View Popular, Search in Google

Apr
11
2010

  • private void copyDataBase() throws IOException{ 

            //Path to the just created empty db, which I carefully closed so I 
    have safe write access 
            OutputStream databaseOutputStream = new FileOutputStream("/data/ 
    data/com.mydomain.myapp/databases/myapp.db"); 
            InputStream databaseInputStream = 
    databaseOpenHelperContext.getResources().openRawResource 
    (R.raw.textfile); 

            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()); 
            } 

            //Close the streams 
            databaseOutputStream.flush(); 
            databaseOutputStream.close(); 
            databaseInputStream.close(); 
     } 

    Add Sticky Note
1 - 15 of 15
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo
Move to top