Skip to content

Commit

Permalink
Fixing unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Chiu committed Nov 16, 2024
1 parent e004c34 commit 44b61af
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,16 @@ public void translate() {
//Download Job
try {
byte[] downloadResult = jobsApiInstance.downloadJob(jobIdInt);
ZipInputStream zip = new ZipInputStream(new ByteArrayInputStream(downloadResult));
zip.getNextEntry();
String zipContents = IOUtils.toString(zip, "UTF-8");
assertEquals(zipContents, "hello world");
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(downloadResult));
List<String> zipContents = new ArrayList<String>();
ZipEntry entry;
while ((entry = zis.getNextEntry())!= null) {
String entryAsString = IOUtils.toString(zis, StandardCharsets.UTF_8);
zipContents.add(entryAsString);
}
IOUtils.closeQuietly(zis);
System.out.println(zipContents);
assertEquals(zipContents.get(1), "hello world");
} catch (ApiException e) {
System.err.println("Exception when calling JobsApi#downloadJob");
printError(e);
Expand Down

0 comments on commit 44b61af

Please sign in to comment.