Static private void CopyDatabase(Context Ctxt, File DBFile) throws IOException If(!DBFile.exists() || DatabaseNeedsUpgrade) //Need to copy. The code goes like this: File Path = Ctxt.getDir("Data", 0) įile DBFile = new File(Path, "database.db") The chunk files are called 1.db, 2.db, etc. As an added bonus, the APK is properly compressed. I've cut up my 4MB file into 1 MB chunks, and on the first run I join the chunks into a data folder on the phone. Java.io.IOException on line "ObjectInputStream ois=new ObjectInputStream(is) "įaced the same issue. This function works well with files smaller than 1M, with bigger files return an Now I have an uncompressed file and I can use it without worrying about the error "This file can not be opened as a file descriptor it is probably compressed" ObjectInputStream ois=new ObjectInputStream(is) InputStream is = mc.getAssets().open(path,3) This is my code for read 1 object from a ObjecInputStream File f = File.createTempFile("mytempfile", "dat") įileOutputStream fos = new FileOutputStream(f) Those who have downloaded the game Reging Thunder, for example, can easily see that in their assets folder is a file 18.9M large. I read that is a limit of Android platform, but I also know that can be "easily" avoided. The method works with a file smaller than 1M, and give error with larger files. I'm going crazy, I created a file object, so it can be read with ObjectInputStream, and I placed the assets folder.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |