MCPcopy Create free account
hub / github.com/diffplug/goomph / read

Method read

src/main/java/com/diffplug/gradle/ZipMisc.java:56–73  ·  view source on GitHub ↗

Reads the given entry from the zip. @param input a zip file @param toRead a path within that zip file @param reader will be called with an InputStream containing the contents of that entry in the zip file

(File input, String toRead, Throwing.Specific.Consumer<InputStream, IOException> reader)

Source from the content-addressed store, hash-verified

54 * @param reader will be called with an InputStream containing the contents of that entry in the zip file
55 */
56 public static void read(File input, String toRead, Throwing.Specific.Consumer<InputStream, IOException> reader) throws IOException {
57 try (
58 ZipFile file = new ZipFile(input);
59 InputStream stream = file.getInputStream(file.getEntry(toRead));) {
60 reader.accept(stream);
61 } catch (NullPointerException e) {
62 if (e.getMessage().equals("entry")) {
63 System.err.println("No such entry: " + toRead);
64 try (ZipFile file = new ZipFile(input)) {
65 Enumeration<? extends ZipEntry> entries = file.entries();
66 while (entries.hasMoreElements()) {
67 ZipEntry entry = entries.nextElement();
68 System.err.println(" available: " + entry.getName());
69 }
70 }
71 }
72 }
73 }
74
75 /**
76 * Reads the given entry from the zip.

Callers 8

testCaseMethod · 0.95
PluginCatalogMethod · 0.95
loadBundleMethod · 0.95
parseFromFileMethod · 0.95
modifyMethod · 0.45
readImgMethod · 0.45
loadImgMethod · 0.45
transferStreamsMethod · 0.45

Calls 6

copyMethod · 0.95
toUnixNewlineMethod · 0.95
acceptMethod · 0.80
hasMoreElementsMethod · 0.80
nextElementMethod · 0.80
equalsMethod · 0.45

Tested by 1

testCaseMethod · 0.76