Когда я пытаюсь распаковать мой файл .gz и перезаписать файл db, я получаю Неизвестный формат (магическое число 5153). Вот мой код для распаковки и перезаписи.
InputStream fIn = c.getAssets().open("MyContacts");
// Path to the just created empty db
String outFileName = DB_PATH + DB_NAME;
//Open the empty db as the output stream
FileOutputStream myOutput = new FileOutputStream(outFileName);
GZIPInputStream gz = new GZIPInputStream(fIn);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[10246];
int length;
while ((length = gz.read(buffer, 0,buffer.length)) != -1){
myOutput.write(buffer, 0, length);
}
//Close the streams
gz.close();
myOutput.flush();
myOutput.close();
fIn.close();