com.github.junrar.Archive.extractFile()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(105)

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

Archive.extractFile介绍

[英]Extract the file specified by the given header and write it to the supplied output stream
[中]提取给定头指定的文件并将其写入提供的输出流

代码示例

代码示例来源:origin: SeanDragon/protools

archive.extractFile(fh, fos);

代码示例来源:origin: edmund-wagner/junrar

public void run() {
    try {
      extractFile(hd, out);
    } catch (RarException e) {
    } finally {
      try {
        out.close();
      } catch (IOException e) {
      }
    }
  }
}).start();

代码示例来源:origin: com.github.junrar/junrar

@Override
public File extract(
  final Archive arch, 
  final FileHeader fileHeader
) throws FileNotFoundException, RarException, IOException {
  final File f = createFile(fileHeader, folderDestination);
  final OutputStream stream = new FileOutputStream(f);
  arch.extractFile(fileHeader, stream);
  stream.close();
  return f;
}

代码示例来源:origin: com.github.junrar/junrar

/**
 * Returns an {@link InputStream} that will allow to read the file and
 * stream it. 
 *
 * @param hd
 *            the header to be extracted
 * @throws RarException .
 *             if any IO error occur
 *             
 * @return inputstream
 */
public InputStream getInputStream(final FileHeader hd) throws RarException {
  final ByteArrayOutputStream out = new ByteArrayOutputStream();
  try {
    extractFile(hd, out);
  } catch (RarException e) {
    throw new RarException(e, RarException.RarExceptionType.ioError);
  } finally {
    try {
      out.close();
    } catch (IOException e) {
      throw new RarException(e, RarException.RarExceptionType.ioError);
    }
  }
  return new ByteArrayInputStream(out.toByteArray());
}

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

a.extractFile(fh, os);
os.close();

代码示例来源:origin: mucommander/mucommander

public void run(){
  try {
    archive.extractFile(header, cbb.getOutputStream());
  } catch (RarException e) {
    if (e.getType() != RarExceptionType.crcError)
      e.printStackTrace();
  }
  finally {
    try {
      cbb.getOutputStream().close();
    } catch (IOException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
  }
 }
}

代码示例来源:origin: dkpro/dkpro-core

Files.createDirectories(out.getParent());
try (OutputStream os = Files.newOutputStream(out)) {
  archive.extractFile(fh, os);

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.api.datasets-asl

Files.createDirectories(out.getParent());
try (OutputStream os = Files.newOutputStream(out)) {
  archive.extractFile(fh, os);

代码示例来源:origin: edmund-wagner/junrar

System.out.println(out.getAbsolutePath());
  FileOutputStream os = new FileOutputStream(out);
  a.extractFile(fh, os);
  os.close();
} catch (FileNotFoundException e) {

相关文章