/** * @param zipOutputStream the zipOutputStream to set */ public void setOutputStream(OutputStream os) { this.zos = new ZipArchiveOutputStream(os); }
@Signature public void __construct(OutputStream outputStream) { __wrappedObject = new ZipArchiveOutputStream(outputStream); }
@Override protected PArchiveOutput createOutput(Environment env) { return new PZipArchiveOutput(env, new ZipArchiveOutputStream(Stream.getOutputStream(env, getSource()))); } }
/** * Creates an archive {@code target} using the format {@code * format} by recursively including all files and directories in * {@code directory}. * * @param format the archive format. This uses the same format as * accepted by {@link ArchiveStreamFactory}. * @param target the channel to write the new archive to. * @param directory the directory that contains the files to archive. * @throws IOException if an I/O error occurs * @throws ArchiveException if the archive cannot be created for other reasons */ public void create(String format, SeekableByteChannel target, File directory) throws IOException, ArchiveException { if (!prefersSeekableByteChannel(format)) { create(format, Channels.newOutputStream(target), directory); } else if (ArchiveStreamFactory.ZIP.equalsIgnoreCase(format)) { create(new ZipArchiveOutputStream(target), directory); } else if (ArchiveStreamFactory.SEVEN_Z.equalsIgnoreCase(format)) { create(new SevenZOutputFile(target), directory); } else { // never reached as prefersSeekableByteChannel only returns true for ZIP and 7z throw new ArchiveException("don't know how to handle format " + format); } }
final ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out); if (actualEncoding != null) { zip.setEncoding(actualEncoding);
@SuppressWarnings("resource") @Override public boolean saveImpl(Document content, OutputStream out) { final ZipArchiveOutputStream zos = (out instanceof ZipArchiveOutputStream) ? (ZipArchiveOutputStream) out : new ZipArchiveOutputStream(out); ZipArchiveEntry partEntry = new ZipArchiveEntry(CONTENT_TYPES_PART_NAME); try { // Referenced in ZIP zos.putArchiveEntry(partEntry); try { // Saving data in the ZIP file return StreamHelper.saveXmlInStream(content, zos); } finally { zos.closeArchiveEntry(); } } catch (IOException ioe) { logger.log(POILogger.ERROR, "Cannot write: " + CONTENT_TYPES_PART_NAME + " in Zip !", ioe); return false; } } }
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(fos);
protected void injectData(ZipEntrySource zipEntrySource, OutputStream out) throws IOException { ZipArchiveOutputStream zos = new ZipArchiveOutputStream(out); try { Enumeration<? extends ZipArchiveEntry> en = zipEntrySource.getEntries();
? (ZipArchiveOutputStream) outputStream : new ZipArchiveOutputStream(outputStream);
public void writeTo(Map<String, byte[]> parts, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { ZipArchiveOutputStream zip = new ZipArchiveOutputStream(entityStream); zip.setMethod(ZipArchiveOutputStream.STORED); for (Map.Entry<String, byte[]> entry : parts.entrySet()) { zipStoreBuffer(zip, entry.getKey(), entry.getValue()); } zip.close(); } }
break; case ZIP: os = new ZipArchiveOutputStream(os); break;
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(os); zos.setEncoding(charsetName); FileInputStream fis = null;
new ZipArchiveOutputStream( bufferedOutputStream( fileOutputStream( zipFile, "zip" ) ) ); zipArchiveOutputStream.setEncoding( encoding ); zipArchiveOutputStream.setCreateUnicodeExtraFields( this.getUnicodeExtraFieldPolicy() );
new ZipArchiveOutputStream( bufferedOutputStream( fileOutputStream( getDestFile(), "jar" ) ) );
private static void repairCopy(File brokenZip, File fixedZip) { try (ZipArchiveOutputStream outputStream = new ZipArchiveOutputStream(fixedZip)) { try (InputStream is = new FileInputStream(brokenZip)) { ZipArchiveInputStream zipArchiveInputStream = new ZipArchiveInputStream(is);
/** * @since 4.0 */ public ArchiveOutputStream createArchiveOutputStream(OutputStream s, Map<String, Object> o) throws IOException { return applyFormatOptions(new ZipArchiveOutputStream(s), o); }
public static byte[] archive(URI uri, String depsDir) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out)) { IOUtils.zip(zip, Paths.get(uri)); if (depsDir != null) { IOUtils.zip(zip, Constants.Files.LIBRARIES_DIR_NAME + "/", Paths.get(depsDir)); } } return out.toByteArray(); }
public static void zipDir(String zipFile, String dir) throws IOException { File dirObj = new File(dir); ZipArchiveOutputStream out = new ZipArchiveOutputStream(new FileOutputStream(zipFile)); log.info("Creating : {}", zipFile); try { addDir(dirObj, out, ""); } finally { out.close(); } }
public void startExport() { // ALF-2016 zipStream = new ZipArchiveOutputStream(outputStream); // NOTE: This encoding allows us to workaround bug... // http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807 zipStream.setEncoding("UTF-8"); zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS); zipStream.setUseLanguageEncodingFlag(true); zipStream.setFallbackToUTF8(true); zipStream.setUseZip64(Zip64Mode.Always); }
public void export(ProcessKey processKey, OutputStream out) throws IOException { String name = name(processKey); if (cfg.isEnabled() && dao.isArchived(processKey)) { try (InputStream in = store.get(name)) { IOUtils.copy(in, out); } } else { try (ZipArchiveOutputStream dst = new ZipArchiveOutputStream(out)) { stateManager.export(processKey, zipTo(dst)); } } }