()
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | protected Map<String, byte[]> loadFiles() throws IOException { |
| 67 | // iterate war entries |
| 68 | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| 69 | byte[] buffer = new byte[8192]; |
| 70 | EntryLoader loader = getEntryLoader(); |
| 71 | try (ZipFile zipFile = new ZipFile(getPath().toFile())) { |
| 72 | Enumeration<? extends ZipEntry> entries = zipFile.entries(); |
| 73 | while(entries.hasMoreElements()) { |
| 74 | // verify entries are not classes and are valid files |
| 75 | // - skip intentional garbage / zip file abnormalities |
| 76 | ZipEntry entry = entries.nextElement(); |
| 77 | if (shouldSkip(entry.getName())) |
| 78 | continue; |
| 79 | if(loader.isValidClassEntry(entry)) |
| 80 | continue; |
| 81 | if(!loader.isValidFileEntry(entry)) |
| 82 | continue; |
| 83 | out.reset(); |
| 84 | InputStream stream = zipFile.getInputStream(entry); |
| 85 | byte[] in = IOUtil.toByteArray(stream, out, buffer); |
| 86 | loader.onFile(entry.getName(), in); |
| 87 | } |
| 88 | } |
| 89 | loader.finishFiles(); |
| 90 | return loader.getFiles(); |
| 91 | } |
| 92 | } |
nothing calls this directly
no test coverage detected