org.apache.camel.util.FileUtil.deleteFile()方法的使用及代码示例

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

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

FileUtil.deleteFile介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-zipfile

@Override
  public void onComplete(Exchange exchange) {
    FileUtil.deleteFile(this.fileToDelete);
  }
}

代码示例来源:origin: org.apache.camel/camel-tarfile

@Override
  public void onComplete(Exchange exchange) {
    LOG.debug("Deleting tar file on completion: {}", this.fileToDelete);
    FileUtil.deleteFile(this.fileToDelete);
  }
}

代码示例来源:origin: org.apache.camel/camel-tarfile

private void addFileToTar(File source, File file, String fileName) throws IOException, ArchiveException {
  File tmpTar = File.createTempFile(source.getName(), null, parentDir);
  tmpTar.delete();
  if (!source.renameTo(tmpTar)) {
    throw new IOException("Could not make temp file (" + source.getName() + ")");
  }
  FileInputStream fis = new FileInputStream(tmpTar);
  TarArchiveInputStream tin = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, fis);
  TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(source));
  tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
  tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
  InputStream in = new FileInputStream(file);
  // copy the existing entries    
  ArchiveEntry nextEntry;
  while ((nextEntry = tin.getNextEntry()) != null) {
    tos.putArchiveEntry(nextEntry);
    IOUtils.copy(tin, tos);
    tos.closeArchiveEntry();
  }
  // Add the new entry
  TarArchiveEntry entry = new TarArchiveEntry(fileName == null ? file.getName() : fileName);
  entry.setSize(file.length());
  tos.putArchiveEntry(entry);
  IOUtils.copy(in, tos);
  tos.closeArchiveEntry();
  IOHelper.close(fis, in, tin, tos);
  LOG.trace("Deleting temporary file: {}", tmpTar);
  FileUtil.deleteFile(tmpTar);
}

代码示例来源:origin: org.apache.camel/camel-tarfile

private void addEntryToTar(File source, String entryName, byte[] buffer, int length) throws IOException, ArchiveException {
  File tmpTar = File.createTempFile(source.getName(), null, parentDir);
  tmpTar.delete();
  if (!source.renameTo(tmpTar)) {
    throw new IOException("Cannot create temp file: " + source.getName());
  }
  FileInputStream fis = new FileInputStream(tmpTar);
  TarArchiveInputStream tin = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, fis);
  TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(source));
  tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
  tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
  // copy the existing entries    
  ArchiveEntry nextEntry;
  while ((nextEntry = tin.getNextEntry()) != null) {
    tos.putArchiveEntry(nextEntry);
    IOUtils.copy(tin, tos);
    tos.closeArchiveEntry();
  }
  // Create new entry
  TarArchiveEntry entry = new TarArchiveEntry(entryName);
  entry.setSize(length);
  tos.putArchiveEntry(entry);
  tos.write(buffer, 0, length);
  tos.closeArchiveEntry();
  IOHelper.close(fis, tin, tos);
  LOG.trace("Deleting temporary file: {}", tmpTar);
  FileUtil.deleteFile(tmpTar);
}

代码示例来源:origin: org.apache.camel/camel-ftp

if (!FileUtil.deleteFile(temp)) {
    throw new GenericFileOperationFailedException("Cannot delete existing local work file: " + temp);
  if (!FileUtil.deleteFile(local)) {
    throw new GenericFileOperationFailedException("Cannot delete existing local work file: " + local);
boolean deleted = FileUtil.deleteFile(temp);
if (!deleted) {
  LOG.warn("Error occurred during retrieving file: " + name + " to local directory. Cannot delete local work file: " + temp);

代码示例来源:origin: org.apache.camel/camel-ftp

if (!FileUtil.deleteFile(local)) {
  throw new GenericFileOperationFailedException("Cannot delete existing local work file: " + local);
if (exists && !FileUtil.deleteFile(temp)) {
  throw new GenericFileOperationFailedException("Cannot delete existing local work file: " + temp);
boolean deleted = FileUtil.deleteFile(temp);
if (!deleted) {
  log.warn("Error occurred during retrieving file: " + name + " to local directory. Cannot delete local work file: " + temp);

代码示例来源:origin: io.konig/konig-camel-aws-s3

FileUtil.deleteFile(filePayload);

代码示例来源:origin: io.konig/konig-camel-aws-s3

FileUtil.deleteFile(filePayload);

相关文章