本文整理了Java中org.uberfire.java.nio.file.Files.setAttribute()
方法的一些代码示例,展示了Files.setAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Files.setAttribute()
方法的具体详情如下:
包路径:org.uberfire.java.nio.file.Files
类名称:Files
方法名:setAttribute
暂无
代码示例来源:origin: kiegroup/appformer
@Override
public Path setAttribute(final Path path,
final String attribute,
final Object value)
throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {
Files.setAttribute(path,
attribute,
value);
return path;
}
代码示例来源:origin: kiegroup/appformer
private void setBatchModeOn(FileSystem fs) {
Files.setAttribute(getFirstRootDirectory(fs),
FileSystemState.FILE_SYSTEM_STATE_ATTR,
FileSystemState.BATCH);
}
代码示例来源:origin: kiegroup/appformer
void unsetBatchModeOn(FileSystem fs) {
Files.setAttribute(getFirstRootDirectory(fs),
FileSystemState.FILE_SYSTEM_STATE_ATTR,
FileSystemState.NORMAL);
}
代码示例来源:origin: kiegroup/appformer
@Override
public Path setAttributes(final Path path,
final FileAttribute<?>... attrs)
throws UnsupportedOperationException, IllegalArgumentException, ClassCastException,
IOException, SecurityException {
Path out = null;
for (final FileAttribute<?> attr : attrs) {
out = Files.setAttribute(path,
attr.name(),
attr.value());
}
return out;
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeNull2() {
assertThatThrownBy(() -> Files.setAttribute(null, "some", null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parameter named 'path' should be not null!");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeNull3() {
assertThatThrownBy(() -> Files.setAttribute(null, null, null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parameter named 'path' should be not null!");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeInvalidView2() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path,
":isRegularFile",
null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage(":isRegularFile");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeInvalidAttr() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path, "myattr", null))
.isInstanceOf(IllegalStateException.class)
.hasMessage("Condition 'invalid attribute' is invalid!");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeEmpty() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path, "", null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parameter named 'attribute' should be filled!");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeNull1() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path, null, null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Parameter named 'attribute' should be filled!");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeInvalidView() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path,
"advanced:isRegularFile",
null))
.isInstanceOf(UnsupportedOperationException.class)
.hasMessage("View 'advanced' not available");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void setAttributeNotImpl() {
final Path path = Files.createTempFile("foo", "bar");
assertThatThrownBy(() -> Files.setAttribute(path,
"isRegularFile",
null))
.isInstanceOf(NotImplementedException.class);
}
内容来源于网络,如有侵权,请联系作者删除!