Skip to content

Commit

Permalink
Added txt and json to the generated zip files, at Lucas's request.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfly committed Dec 13, 2011
1 parent fc8cb95 commit 55f8c6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# After editing this file, be sure to commit
# all your code, and then run "tmt make release -p timer"!
0.1.4
0.2
16 changes: 14 additions & 2 deletions webscrambles/src/tnoodleServerHandler/ScrambleRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ public static ByteArrayOutputStream requestsToZip(String globalTitle, Date gener
ZipOutputStream zipOut = new ZipOutputStream(baosZip);
zipOut.setComment(globalTitle + " zip created on " + Utils.SDF.format(generationDate));
for(ScrambleRequest scrambleRequest : scrambleRequests) {
String fileName = scrambleRequest.title + ".pdf";
ZipEntry entry = new ZipEntry(fileName);
String pdfFileName = "pdf/" + scrambleRequest.title + ".pdf";
ZipEntry entry = new ZipEntry(pdfFileName);
zipOut.putNextEntry(entry);

PdfReader pdfReader = createPdf(globalTitle, generationDate, scrambleRequest);
Expand All @@ -532,7 +532,19 @@ public static ByteArrayOutputStream requestsToZip(String globalTitle, Date gener
zipOut.write(b);

zipOut.closeEntry();

String txtFileName = "txt/" + scrambleRequest.title + ".txt";
entry = new ZipEntry(txtFileName);
zipOut.putNextEntry(entry);
zipOut.write(Utils.join(scrambleRequest.scrambles, "\r\n").getBytes());
zipOut.closeEntry();
}

ZipEntry entry = new ZipEntry(globalTitle + ".json");
zipOut.putNextEntry(entry);
zipOut.write(GSON.toJson(scrambleRequests).getBytes());
zipOut.closeEntry();

zipOut.close();

return baosZip;
Expand Down

0 comments on commit 55f8c6a

Please sign in to comment.