私は本当に間違ったことをしているに違いない。Android で次のコードを実行すると、ログに例外や問題がなく、切り捨てられたファイル (_items_) が生成されます。OpenJDK 7 で同じコードを実行すると、ファイルが正しく解凍されます。
try {
final InputStream fis = new GZIPInputStream(new FileInputStream("/storage/sdcard/_items"));
try {
final FileOutputStream fos = new FileOutputStream("/storage/sdcard/_items_");
try {
final byte[] buffer = new byte[1024];
int n;
while ((n = fis.read(buffer)) != -1) {
fos.write(buffer, 0, n);
}
} finally {
fos.close();
}
} finally {
fis.close();
}
} catch (final IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
私はこれを Android エミュレーター (API 18) と Desire HD (Android 2.3.5) で試しましたが、結果は同じでした。
入力ファイル (_items): https://drive.google.com/file/d/0B6M72P2gzYmwaHg4SzRTYnRMOVk/edit?usp=sharing
Android 切り捨て出力ファイル (_items_): https://drive.google.com/file/d/0B6M72P2gzYmwMUZIZ2FEaHNZUFk/edit?usp=sharing