Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'feature/smg-flow'
  • Loading branch information
dds14002 committed Mar 3, 2020
2 parents ff84ec7 + ddbb7b8 commit d5c3702
Showing 1 changed file with 9 additions and 10 deletions.
Expand Up @@ -64,22 +64,21 @@ public class SmgService {

@Nullable
public byte[] repackageSmg(Map<String, byte[]> entryMap) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
for(Map.Entry<String, byte[]> entry : entryMap.entrySet()) {
ZipEntry zipEntry = new ZipEntry(entry.getKey());
zos.putNextEntry(zipEntry);
zos.write(entry.getValue());
zos.closeEntry();
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
for(Map.Entry<String, byte[]> entry : entryMap.entrySet()) {
ZipEntry zipEntry = new ZipEntry(entry.getKey());
zos.putNextEntry(zipEntry);
zos.write(entry.getValue());
zos.closeEntry();
}
}
return bos.toByteArray();
} catch (IOException e) {
log.error("Failed to repackage smg file");
e.printStackTrace();
return null;
}

return bos.toByteArray();

}

}

0 comments on commit d5c3702

Please sign in to comment.