gpt4 book ai didi

org.sakaiproject.content.util.ZipContentUtil类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 20:27:31 25 4
gpt4 key购买 nike

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

ZipContentUtil介绍

暂无

代码示例

代码示例来源:origin: org.sakaiproject.assignment/sakai-assignment-impl

/**
 * get a list of the files in the archive
 * @param r
 * @return
 */
private Object getArchiveManifest(Reference r) {
  String extension = getFileExtension(r);
  StringBuilder builder = new StringBuilder();
  if (".zip".equals(extension)) {
    ZipContentUtil zipUtil = new ZipContentUtil();
    Map<String, Long> manifest = zipUtil.getZipManifest(r);
    Set<Entry<String, Long>> set = manifest.entrySet();
    Iterator<Entry<String, Long>> it = set.iterator();
    while (it.hasNext()) {
      Entry<String, Long> entry = it.next();
      builder.append(entry.getKey() + " (" + formatFileSize(entry.getValue()) + ")" + newline);
    }
  }
  
  return builder.toString();
}

代码示例来源:origin: sakaiproject/sakai

/**
 * Extracts a compressed (zip) ContentResource to a new folder with the same name.
 * 
 * @param reference the sakai entity reference
 * @throws Exception on failure
 * @deprecated 11 Oct 2011 -AZ, use {@link #extractArchive(String)} instead
 */
public void extractArchive(Reference reference) throws Exception {
  if (reference == null) {
    throw new IllegalArgumentException("reference cannot be null");
  }
  extractArchive(reference.getId());
}

代码示例来源:origin: org.sakaiproject.content/content-types

public void initializeAction(Reference reference) {
  try {
    zipUtil.compressFolder(reference);
  } catch (Exception e) {
    logger.warn(e.getMessage());
  }            
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

int maxZipExtractSize = ZipContentUtil.getMaxZipExtractFiles();
ZipContentUtil extractZipArchive = new ZipContentUtil();
Map<String, Long> zipManifest = extractZipArchive.getZipManifest(resourceId);
if (zipManifest == null) {
  log.error("Zip file for resource ("+resourceId+") has no zip manifest, cannot extract");
  extractZipArchive.extractArchive(resourceId);

代码示例来源:origin: sakaiproject/sakai

String rootCollectionId = extractZipCollectionPrefix(resource);
prop.addProperty(ResourcePropertiesEdit.PROP_DISPLAY_NAME, extractZipCollectionName(resource));
ContentHostingService.commitCollection(rootCollection);            
  temp = exportResourceToFile(resource);
  boolean extracted = false;
  for (String charsetName: getZipCharsets()) {
    Charset charset;
    try {
        if (!nextElement.getName().contains("__MACOSX")){
          if (nextElement.isDirectory()) {
            createContentCollection(rootCollectionId, nextElement);
              createContentResource(rootCollectionId, nextElement, zipFile);
    log.warn(String.format("Cannot extract archives %s with any charset %s.", referenceId, getZipCharsets()));

代码示例来源:origin: sakaiproject/sakai

temp = exportResourceToFile(resource);
boolean extracted = false;
for (String charsetName: getZipCharsets()) {
  Charset charset;
  try {
    while (entries.hasMoreElements() && i <= getMaxZipExtractFiles()) {
      ZipEntry nextElement = entries.nextElement();                        
      ret.put(nextElement.getName(), nextElement.getSize());
  log.warn(String.format("Cannot get menifest of %s with any charset %s.", referenceId, getZipCharsets()));

代码示例来源:origin: sakaiproject/sakai

/**
 * Get a list of the files in a zip and their size
 * @param reference the sakai entity reference
 * @return a map of file names to file sizes in the zip archive
 * @deprecated 11 Oct 2011 -AZ, use {@link #getZipManifest(String)}
 */
public Map<String, Long> getZipManifest(Reference reference) {
  if (reference == null) {
    throw new IllegalArgumentException("reference cannot be null");
  }
  return getZipManifest(reference.getId());
}

代码示例来源:origin: sakaiproject/sakai

ContentCollection collection = ContentHostingService.getCollection(reference.getId());
  out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(temp),BUFFER_SIZE),java.nio.charset.StandardCharsets.UTF_8);
  storeContentCollection(reference.getId(),collection,out);
} finally {
  if (out != null) {
String resourceName = extractName(resourceId);			
String homeCollectionId = (String) toolSession.getAttribute(STATE_HOME_COLLECTION_ID);
if(homeCollectionId != null && homeCollectionId.equals(reference.getId())){
addAlert(toolSession, rb.getString("permission_error_zip"));
log.warn(pE.getMessage(), pE);
addAlert(toolSession, rb.getString("generic_error_zip"));
log.error(e.getMessage(), e);

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