gpt4 book ai didi

org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 20:24:40 36 4
gpt4 key购买 nike

本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close()方法的一些代码示例,展示了ZipArchiveOutputStream.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveOutputStream.close()方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
类名称:ZipArchiveOutputStream
方法名:close

ZipArchiveOutputStream.close介绍

[英]Closes this output stream and releases any system resources associated with the stream.
[中]关闭此输出流并释放与该流关联的所有系统资源。

代码示例

代码示例来源:origin: plutext/docx4j

public void finishSave() throws Docx4JException {
  try {
    // Complete the ZIP file
    // Don't forget to do this or everything will appear
    // to work, but when you open the zip file you'll get an error
    // "End-of-central-directory signature not found."
    zos.close();
  } catch (Exception e ) {
    throw new Docx4JException("Failed to put binary part", e);
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

zos.closeArchiveEntry();
zos.close();
fos.close();
zis.close();

代码示例来源:origin: naver/ngrinder

zos.close();

代码示例来源:origin: apache/tika

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();
  }
}

代码示例来源:origin: apache/tika

outputStream.close();

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

zipArchiveOutputStream.close();

代码示例来源:origin: USPTO/PatentPublicData

@Override
public void close() throws IOException {
  if (outputZip != null){
    outputZip.closeArchiveEntry();
    outputZip.close();
  }
  outputZip = null;
}

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

public void writeTo( ZipArchiveOutputStream targetStream ) throws IOException, ExecutionException,
                                 InterruptedException
{
  metaInfDir.writeTo( targetStream );
  manifest.writeTo( targetStream );
  directories.writeTo( targetStream );
  synchronousEntries.writeTo( targetStream );
  parallelScatterZipCreator.writeTo( targetStream );
  long startAt = System.currentTimeMillis();
  targetStream.close();
  zipCloseElapsed = System.currentTimeMillis() - startAt;
  metaInfDir.close();
  manifest.close();
  directories.close();
  synchronousEntries.close();
}

代码示例来源:origin: stackoverflow.com

byte[] zip(byte[] data, String filename) {
   ByteArrayOutputStream bos = new ByteArrayOutputStream();
   ZipArchiveOutputStream zos = new ZipArchiveOutputStream(bos);
   ZipArchiveEntry entry = new ZipArchiveEntry(filename);
   entry.setSize(data.length);
   zos.putArchiveEntry(entry);
   zos.write(data);
   zos.closeArchiveEntry();
   zos.close();
   bos.close();
   return bos.toByteArray();       
 }

代码示例来源:origin: edu.jhu.hlt/acute

@Override
public void close() throws IOException {
 this.zout.close();
}

代码示例来源:origin: com.haulmont.reports/reports-core

protected byte[] zipContent(Map<String, Object> stringObjectMap) throws IOException {
  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(byteArrayOutputStream);
  zipOutputStream.setMethod(ZipArchiveOutputStream.STORED);
  zipOutputStream.setEncoding(ENCODING);
  for (Map.Entry<String, Object> entry : stringObjectMap.entrySet()) {
    byte[] data = (byte[]) entry.getValue();
    ArchiveEntry archiveEntry = newStoredEntry(entry.getKey(), data);
    zipOutputStream.putArchiveEntry(archiveEntry);
    zipOutputStream.write(data);
    zipOutputStream.closeArchiveEntry();
  }
  zipOutputStream.close();
  return byteArrayOutputStream.toByteArray();
}

代码示例来源:origin: org.alfresco/alfresco-repository

@Override
public void end()
{
  try
  {
    zipStream.close();
  }
  catch (IOException error)
  {
    throw new ExporterException("Unexpected error closing zip stream!", error);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

public static void writeArchivedLogTailToStream(File logFile, OutputStream outputStream) throws IOException {
  if (!logFile.exists()) {
    throw new FileNotFoundException();
  }
  ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(outputStream);
  zipOutputStream.setMethod(ZipArchiveOutputStream.DEFLATED);
  zipOutputStream.setEncoding(ZIP_ENCODING);
  byte[] content = getTailBytes(logFile);
  ArchiveEntry archiveEntry = newTailArchive(logFile.getName(), content);
  zipOutputStream.putArchiveEntry(archiveEntry);
  zipOutputStream.write(content);
  zipOutputStream.closeArchiveEntry();
  zipOutputStream.close();
}

代码示例来源:origin: org.docx4j/docx4j

public void finishSave() throws Docx4JException {
  try {
    // Complete the ZIP file
    // Don't forget to do this or everything will appear
    // to work, but when you open the zip file you'll get an error
    // "End-of-central-directory signature not found."
    zos.close();
  } catch (Exception e ) {
    throw new Docx4JException("Failed to put binary part", e);
  }
}

代码示例来源:origin: Alfresco/alfresco-repository

@Override
public void end()
{
  try
  {
    zipStream.close();
  }
  catch (IOException error)
  {
    throw new ExporterException("Unexpected error closing zip stream!", error);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-filter-stream-xar

@Override
  public void close() throws IOException
  {
    // Add package.xml descriptor
    try {
      writePackage();
    } catch (FilterException e) {
      throw new IOException("Failed to write package", e);
    }

    // Close zip stream
    this.zipStream.close();
  }
}

代码示例来源:origin: org.openengsb.connector/org.openengsb.connector.git

@Override
public File export() {
  try {
    if (repository == null) {
      initRepository();
    }
    LOGGER.debug("Exporting repository to archive");
    File tmp = File.createTempFile("repository", ".zip");
    ZipArchiveOutputStream zos = new ZipArchiveOutputStream(tmp);
    packRepository(localWorkspace, zos);
    zos.close();
    return tmp;
  } catch (IOException e) {
    throw new ScmException(e);
  }
}

代码示例来源:origin: org.apache.wookie/wookie-parser

/**
 * Packages the source file/folder up as a new Zip file
 * @param source the source file or folder to be zipped
 * @param target the zip file to create
 * @throws IOException
 */
public static void repackZip(File source, File target) throws IOException{
  ZipArchiveOutputStream out = new ZipArchiveOutputStream(target);
  out.setEncoding("UTF-8");
  for(File afile: source.listFiles()){
    pack(afile,out, "");
  }
  out.flush();
  out.close();
}

代码示例来源:origin: org.apache.slider/slider-core

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();
 }
}

代码示例来源:origin: apache/incubator-slider

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();
 }
}

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com