@Override public FatJarBuilder getBuilder(JarPackageData jarPackageData) { return new FatJarRsrcUrlBuilder(); }
public void writeRsrcUrlClasses() throws IOException { InputStream is= JavaPlugin.getDefault().getBundle().getEntry(JAR_RSRC_LOADER_ZIP).openStream(); ZipInputStream zis= new ZipInputStream(is); ZipEntry zipEntry= zis.getNextEntry(); while (zipEntry != null) { if (!zipEntry.isDirectory()) { String entryName= zipEntry.getName(); byte[] content= FatJarPackagerUtil.readInputStream(zis); getJarWriter().addZipEntryStream(zipEntry, new ByteArrayInputStream(content), entryName); } zipEntry= zis.getNextEntry(); } } }
@Override public void open(JarPackageData jarPackage, Shell displayShell, MultiStatus status) throws CoreException { super.open(jarPackage, displayShell, status); fJarPackage= jarPackage; jarNames= new HashSet<>(); try { writeRsrcUrlClasses(); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, e.getMessage(), e)); } }
public void writeRsrcUrlClasses() throws IOException { InputStream is= JavaPlugin.getDefault().getBundle().getEntry(JAR_RSRC_LOADER_ZIP).openStream(); ZipInputStream zis= new ZipInputStream(is); ZipEntry zipEntry= zis.getNextEntry(); while (zipEntry != null) { if (!zipEntry.isDirectory()) { String entryName= zipEntry.getName(); byte[] content= FatJarPackagerUtil.readInputStream(zis); getJarWriter().addZipEntryStream(zipEntry, new ByteArrayInputStream(content), entryName); } zipEntry= zis.getNextEntry(); } } }
@Override public void open(JarPackageData jarPackage, Shell displayShell, MultiStatus status) throws CoreException { super.open(jarPackage, displayShell, status); fJarPackage= jarPackage; jarNames= new HashSet<>(); try { writeRsrcUrlClasses(); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, e.getMessage(), e)); } }
@Override public FatJarBuilder getBuilder(JarPackageData jarPackageData) { return new FatJarRsrcUrlBuilder(); }
@Override public void writeArchive(ZipFile jarFile, IProgressMonitor progressMonitor) { File jarPathFile= new File(jarFile.getName()); String jarName = jarPathFile.getName(); while (jarNames.contains(jarName)) { jarName= FatJarPackagerUtil.nextNumberedFileName(jarName); } jarNames.add(jarName); JarEntry newEntry = new JarEntry(jarName); newEntry.setMethod(ZipEntry.STORED); byte[] readBuffer= new byte[4096]; try { if (!fJarPackage.isCompressed()) JarPackagerUtil.calculateCrcAndSize(newEntry, new FileInputStream(jarPathFile), readBuffer); getJarWriter().addZipEntryStream(newEntry, new FileInputStream(jarPathFile), jarName); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public FatJarBuilder getBuilder(JarPackageData jarPackageData) { return new FatJarRsrcUrlBuilder(); }
@Override public void writeArchive(ZipFile jarFile, IProgressMonitor progressMonitor) { File jarPathFile= new File(jarFile.getName()); String jarName = jarPathFile.getName(); while (jarNames.contains(jarName)) { jarName= FatJarPackagerUtil.nextNumberedFileName(jarName); } jarNames.add(jarName); JarEntry newEntry = new JarEntry(jarName); newEntry.setMethod(ZipEntry.STORED); byte[] readBuffer= new byte[4096]; try { if (!fJarPackage.isCompressed()) JarPackagerUtil.calculateCrcAndSize(newEntry, new FileInputStream(jarPathFile), readBuffer); getJarWriter().addZipEntryStream(newEntry, new FileInputStream(jarPathFile), jarName); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } }