MCPcopy Index your code
hub / github.com/processing/processing / buildZip

Method buildZip

app/src/processing/app/tools/Archiver.java:139–166  ·  view source on GitHub ↗
(File dir, String sofar,
                       ZipOutputStream zos)

Source from the content-addressed store, hash-verified

137
138
139 private void buildZip(File dir, String sofar,
140 ZipOutputStream zos) throws IOException {
141 String files[] = dir.list();
142 for (int i = 0; i < files.length; i++) {
143 if (files[i].equals(".") || //$NON-NLS-1$
144 files[i].equals("..")) continue; //$NON-NLS-1$
145
146 File sub = new File(dir, files[i]);
147 String nowfar = (sofar == null) ?
148 files[i] : (sofar + "/" + files[i]); //$NON-NLS-1$
149
150 if (sub.isDirectory()) {
151 // directories are empty entries and have / at the end
152 ZipEntry entry = new ZipEntry(nowfar + "/"); //$NON-NLS-1$
153 //System.out.println(entry);
154 zos.putNextEntry(entry);
155 zos.closeEntry();
156 buildZip(sub, nowfar, zos);
157
158 } else {
159 ZipEntry entry = new ZipEntry(nowfar);
160 entry.setTime(sub.lastModified());
161 zos.putNextEntry(entry);
162 zos.write(Util.loadBytesRaw(sub));
163 zos.closeEntry();
164 }
165 }
166 }
167}

Callers 1

fileSelectedMethod · 0.95

Calls 4

loadBytesRawMethod · 0.95
writeMethod · 0.65
listMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected