org.eclipse.equinox.internal.p2.core.helpers.FileUtils.unzipStream()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(126)

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

FileUtils.unzipStream介绍

[英]Unzip from an InputStream to an output directory.
[中]从InputStream解压到输出目录。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory, with progress indication.
 * monitor may be null.
 */
public static File[] unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
  try (InputStream in = new FileInputStream(zipFile)) {
    return unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
  } catch (IOException e) {
    // add the file name to the message
    IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    ioException.initCause(e);
    throw ioException;
  }
}

代码示例来源:origin: org.eclipse.equinox.p2/core

/**
 * Unzip from a File to an output directory, with progress indication.
 * monitor may be null.
 */
public static File[] unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
  } catch (IOException e) {
    // add the file name to the message
    throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
  } finally {
    in.close();
  }
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory, with progress indication.
 * monitor may be null.
 */
public static File[] unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
  } catch (IOException e) {
    // add the file name to the message
    throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
  } finally {
    in.close();
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory, with progress indication.
 * monitor may be null.
 */
public static File[] unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
  } catch (IOException e) {
    // add the file name to the message
    IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    ioException.initCause(e);
    throw ioException;
  } finally {
    in.close();
  }
}

代码示例来源:origin: org.eclipse.equinox.p2/core

/**
 * Unzip from a File to an output directory.
 */
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
  // check to see if we have a tar'd and gz'd file
  if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
    try {
      return untarFile(zipFile, outputDir);
    } catch (TarException e) {
      throw new IOException(e.getMessage());
    }
  }
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, null, null);
  } catch (IOException e) {
    // add the file name to the message
    throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
  } finally {
    in.close();
  }
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory.
 */
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
  // check to see if we have a tar'd and gz'd file
  if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
    try {
      return untarFile(zipFile, outputDir);
    } catch (TarException e) {
      throw new IOException(e.getMessage());
    }
  }
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, null, null);
  } catch (IOException e) {
    // add the file name to the message
    throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
  } finally {
    in.close();
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory.
 */
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
  // check to see if we have a tar'd and gz'd file
  if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
    try {
      return untarFile(zipFile, outputDir);
    } catch (TarException e) {
      IOException ioException = new IOException(e.getMessage());
      ioException.initCause(e);
      throw ioException;
    }
  }
  try (InputStream in = new FileInputStream(zipFile)) {
    return unzipStream(in, zipFile.length(), outputDir, null, null);
  } catch (IOException e) {
    // add the file name to the message
    IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    ioException.initCause(e);
    throw ioException;
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core

/**
 * Unzip from a File to an output directory.
 */
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
  // check to see if we have a tar'd and gz'd file
  if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
    try {
      return untarFile(zipFile, outputDir);
    } catch (TarException e) {
      IOException ioException = new IOException(e.getMessage());
      ioException.initCause(e);
      throw ioException;
    }
  }
  InputStream in = new FileInputStream(zipFile);
  try {
    return unzipStream(in, zipFile.length(), outputDir, null, null);
  } catch (IOException e) {
    // add the file name to the message
    IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    ioException.initCause(e);
    throw ioException;
  } finally {
    in.close();
  }
}

相关文章