本文整理了Java中de.matrixweb.vfs.VFS.rollback()
方法的一些代码示例,展示了VFS.rollback()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VFS.rollback()
方法的具体详情如下:
包路径:de.matrixweb.vfs.VFS
类名称: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!