public static byte[] getIntegrationClass(ClassLoader c, String name) { if (!integrationClassloader.contains(c)) { return null; } URL resource = ClassLoader.getSystemClassLoader().getResource(name.replace('.', '/') + ".class"); if (resource == null) { throw new RuntimeException("Could not load integration class " + name); } try (InputStream in = resource.openStream()) { return org.fakereplace.util.FileReader.readFileBytes(resource.openStream()); } catch (Exception e) { throw new RuntimeException(e); } }
hashes.put(file.toAbsolutePath(), MD5.md5(FileReader.readFileBytes(in))); } catch (IOException e) { e.printStackTrace();
if (change.getType() == WatchServiceFileSystemWatcher.FileChangeEvent.Type.ADDED) { try (FileInputStream in = new FileInputStream(change.getFile().toFile())) { byte[] bytes = FileReader.readFileBytes(in); ClassFile file = new ClassFile(new DataInputStream(new ByteArrayInputStream(bytes))); addedClasses.add(new AddedClass(file.getName(), bytes, classLoader)); byte[] bytes = FileReader.readFileBytes(in); if (!hash.equals(MD5.md5(bytes))) { ClassFile file = new ClassFile(new DataInputStream(new ByteArrayInputStream(bytes)));
ret.add(new ZipJavaFileObject(org.fakereplace.util.FileReader.readFileBytes(res.openStream()), binaryName, res.getURL().toURI())); } catch (URISyntaxException e) { e.printStackTrace(); try { URI uri = new URI(res.toExternalForm() + "/" + rem); ret.add(new ZipJavaFileObject(org.fakereplace.util.FileReader.readFileBytes(uri.toURL().openStream()), binaryName, uri)); } catch (Exception e) { e.printStackTrace();