public JarFile getJarFile() { return jarFileModule.getJarFile(); }
public JarFile getJarFile() { return jarFileModule.getJarFile(); }
@Override public int hashCode() { return entryName.hashCode() * 5059 + jarFileModule.getJarFile().hashCode(); }
public long getSize() { // TODO: cache this? return jarFileModule.getJarFile().getEntry(entryName).getSize(); }
public long getSize() { // TODO: cache this? return jarFileModule.getJarFile().getEntry(entryName).getSize(); }
@Override public int hashCode() { return entryName.hashCode() * 5059 + jarFileModule.getJarFile().hashCode(); }
@Override public InputStream getInputStream() { try { JarFile jarFile = jarFileModule.getJarFile(); return jarFile.getInputStream(jarFile.getEntry(entryName)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Assertions.UNREACHABLE(); return null; } }
@Override public InputStream getInputStream() { try { JarFile jarFile = jarFileModule.getJarFile(); return jarFile.getInputStream(jarFile.getEntry(entryName)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Assertions.UNREACHABLE(); return null; } }
@Override public String toString() { return jarFileModule.getJarFile().getName() + ':' + getName(); }
@Override public Module asModule() { return new NestedJarFileModule(jarFileModule, jarFileModule.getJarFile().getEntry(entryName)); }
@Override public Module asModule() { return new NestedJarFileModule(jarFileModule, jarFileModule.getJarFile().getEntry(entryName)); }
@Override public String toString() { return jarFileModule.getJarFile().getName() + ':' + getName(); }
/** * get the contents of a jar file. if any IO exceptions occur, catch and return null. */ private static void getJarFileContents(JarFileModule archive) { String jarFileName = archive.getJarFile().getName(); InputStream s = null; try { File jarFile = (new FileProvider()).getFile(jarFileName); int bufferSize = 65536; s = new BufferedInputStream(new FileInputStream(jarFile), bufferSize); byte[] b = new byte[1024]; int n = s.read(b); while (n != -1) { n = s.read(b); } } catch (IOException e) { } finally { try { if (s != null) { s.close(); } } catch (IOException e) { } } }
/** * get the contents of a jar file. if any IO exceptions occur, catch and return null. */ private static void getJarFileContents(JarFileModule archive) { String jarFileName = archive.getJarFile().getName(); InputStream s = null; try { File jarFile = (new FileProvider()).getFile(jarFileName); int bufferSize = 65536; s = new BufferedInputStream(new FileInputStream(jarFile), bufferSize); byte[] b = new byte[1024]; int n = s.read(b); while (n != -1) { n = s.read(b); } } catch (IOException e) { } finally { try { if (s != null) { s.close(); } } catch (IOException e) { } } }
/** * @return the rt.jar (1.4) or core.jar (1.5) file, or null if not found. */ private JarFile getRtJar() { return RtJar.getRtJar( new MapIterator<Module,JarFile>( new FilterIterator<>(getModules(getPrimordialLoader()).iterator(), JarFileModule.class::isInstance), M -> ((JarFileModule) M).getJarFile())); }
/** * @return the rt.jar (1.4) or core.jar (1.5) file, or null if not found. */ private JarFile getRtJar() { return RtJar.getRtJar( new MapIterator<Module,JarFile>( new FilterIterator<>(getModules(getPrimordialLoader()).iterator(), JarFileModule.class::isInstance), M -> ((JarFileModule) M).getJarFile())); }