Guys,
Estou desenvolvendo um aap para android e usso a ksoap2 para comunicação. Eu recebo um arquivo zip do WebService, e para isso, recebo um SoapPrimitive com o arquivo em formato de byte[].
A pergunta de 1 milhão é: Como recuperar estes array de bytes? e Mais, como transcrever isso em um arquivo zip?
No momento, fiz isso:
//Pegando o array de bytes
SoapPrimitive object = (SoapPrimitive) result.getProperty(0);
String stream = object.toString();
zipBytes("arquivoDB", byteArray,loginActivity);
//Conteudo do método zipBytes
ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(input));
ZipEntry entry = null;
while ((entry = zipStream.getNextEntry()) != null) {
String entryName = entry.getName();
FileOutputStream out = new FileOutputStream(entryName);
byte[] buf = new byte[4096];
int bytesRead = 0;
while ((bytesRead = zipStream.read(buf)) != -1) {
out.write(buf, 0, bytesRead);
}
out.close();
zipStream.closeEntry();
}
zipStream.close();
Alguma luz?