de.matrixweb.vfs.VFS.rollback()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(116)

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

VFS.rollback介绍

暂无

代码示例

代码示例来源:origin: de.matrixweb.smaller/merge

private Resource executeComplexMerge(final VFS vfs, final Resource resource,
  final Map<String, Object> options) throws IOException {
 final Object typeOption = options.get("type");
 if (!(resource instanceof ResourceGroup) || typeOption != null
   && resource.getType() != Type.valueOf(typeOption.toString())) {
  return resource;
 }
 final ResourceGroup group = (ResourceGroup) resource;
 final Resource input = group.getResources().get(0);
 final VFile snapshot = vfs.stack();
 try {
  final VFile target = vfs.find(input.getPath());
  final Writer writer = VFSUtils.createWriter(target);
  try {
   writer.write(group.getMerger().merge(group.getResources()));
  } finally {
   IOUtils.closeQuietly(writer);
  }
  return input.getResolver().resolve(target.getPath());
 } catch (final IOException e) {
  vfs.rollback(snapshot);
  throw e;
 }
}

代码示例来源:origin: de.matrixweb.smaller/resource

: null;
} catch (final IOException e) {
 vfs.rollback(snapshot);
 throw e;

代码示例来源:origin: de.matrixweb.smaller/resource

vfs.rollback(snapshot);
throw e;

代码示例来源:origin: de.matrixweb.smaller/merge

/**
 * @see de.matrixweb.smaller.resource.Processor#execute(de.matrixweb.vfs.VFS,
 *      de.matrixweb.smaller.resource.Resource, java.util.Map)
 */
@Override
public Resource execute(final VFS vfs, final Resource resource,
  final Map<String, Object> options) throws IOException {
 // Version 1.0.0 handling
 if (getVersion(options).isAtLeast(Version._1_0_0)) {
  try {
   if (!(resource instanceof ResourceGroup) && resource != null
     && FilenameUtils.isExtension(resource.getPath(), "json")) {
    return executeSimpleMerge(vfs, resource, options);
   }
   return executeComplexMerge(vfs, resource, options);
  } catch (final IOException e) {
   throw new SmallerException("Failed to merge files", e);
  }
 }
 final VFile snapshot = vfs.stack();
 try {
  final VFile file = vfs.find(resource.getPath());
  VFSUtils.write(file, resource.getContents());
  return resource.getResolver().resolve(file.getPath());
 } catch (final IOException e) {
  vfs.rollback(snapshot);
  throw e;
 }
}

相关文章