나는 3 개의 XML 파일을 만들고 zip 폴더로 압축했습니다. 폴더는 서버에서 전송됩니다. 브라우저를 통해 zip 폴더를 다운로드 할 때 제대로 작동하고 파일을 추출 할 수 있습니다. 하지만 안드로이드 응용 프로그램에서 다운로드하여 SD 카드에 저장하면 손상됩니다. 파일을 컴퓨터에서 SD 카드로 가져 와서 폴더를 추출하려고했는데 우편 폴더가 잘못되었습니다.입니다. 내가 스트림에서 값을 저장할 수 없습니다android : Zip 폴더가 잘못되었습니다.
ZipInputStream zin = new ZipInputStream(new BufferedInputStream(is));
ZipInputStream
을 사용하는 경우
DefaultHttpClient httpclient1 = new DefaultHttpClient();
HttpPost httpPostRequest = new HttpPost(
Configuration.URL_FEED_UPDATE);
byte[] responseByte = httpclient1.execute(httpPostRequest,
new BasicResponseHandler()).getBytes();
InputStream is = new ByteArrayInputStream(responseByte);
// ---------------------------------------------------
File file1 = new File(Environment
.getExternalStorageDirectory() + "/ast");
file1.mkdirs();
//
File outputFile = new File(file1, "ast.zip");
FileOutputStream fos = new FileOutputStream(outputFile);
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is.read(buffer)) != -1) {
fos.write(buffer, 0, len1);
}
fos.close();
is.close();
: 내 코드는 아래와 같습니다.