org.uberfire.java.nio.file.Files.createTempFile()方法的使用及代码示例

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

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

Files.createTempFile介绍

暂无

代码示例

代码示例来源:origin: kiegroup/appformer

@Override
public Path createTempFile(final String prefix,
              final String suffix,
              final FileAttribute<?>... attrs)
    throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {
  return Files.createTempFile(prefix,
                suffix,
                attrs);
}

代码示例来源:origin: kiegroup/appformer

public static Path createTempFile(final String prefix,
                 final String suffix,
                 final FileAttribute<?>... attrs)
    throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {
  return createTempFile(TEMP_PATH,
             prefix,
             suffix,
             attrs);
}

代码示例来源:origin: org.uberfire/uberfire-nio2-api

public static Path createTempFile(final String prefix,
                 final String suffix,
                 final FileAttribute<?>... attrs)
    throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {
  return createTempFile(TEMP_PATH,
             prefix,
             suffix,
             attrs);
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = FileAlreadyExistsException.class)
public void createLinkIllegalStateException1() {
  Files.createLink(Files.createTempFile("foo",
                     "bar"),
           Files.createTempFile("foo",
                     "bar"));
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = FileAlreadyExistsException.class)
public void createSymbolicLinkIllegalStateException1() {
  Files.createSymbolicLink(Files.createTempFile("foo",
                         "bar"),
               Files.createTempFile("foo",
                         "bar"));
}

代码示例来源: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 readAttributeInvalid() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThatThrownBy(() -> Files.getAttribute(path, "*"))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("*");
}

代码示例来源: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 setLastModifiedTimeNull2() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThatThrownBy(() -> Files.setLastModifiedTime(path, null))
      .isInstanceOf(NotImplementedException.class);
}

代码示例来源:origin: kiegroup/appformer

@Test
public void setAttributeNotImpl() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThatThrownBy(() -> Files.setAttribute(path,
                        "isRegularFile",
                        null))
      .isInstanceOf(NotImplementedException.class);
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = NotDirectoryException.class)
public void newDirectoryStreamGlobNotDirectoryException() {
  Files.newDirectoryStream(Files.createTempFile("foo",
                         "bar"),
               "*.*");
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = UnsupportedOperationException.class)
public void probeContentType() {
  Files.probeContentType(Files.createTempFile(null,
                        null));
}

代码示例来源:origin: kiegroup/appformer

@Test
public void copyIn2PathNull4() {
  assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile("foo",
                                         "bar")),
                    newTempDir().resolve("my_new_file.txt"),
                    new CopyOption[]{null}))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'opt' should be not null!");
}

代码示例来源:origin: kiegroup/appformer

@Test
public void copyIn2PathInvalidOption() {
  assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile("foo",
                                         "bar")),
                    newTempDir().resolve("my_new_file.txt"),
                    NOFOLLOW_LINKS))
      .isInstanceOf(UnsupportedOperationException.class)
      .hasMessage("NOFOLLOW_LINKS not supported");
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = IllegalArgumentException.class)
public void visitFileFailedNull1() {
  final Path dir = newTempDir(null);
  final Path file = Files.createTempFile(dir,
                      "foo",
                      "bar");
  simple.visitFileFailed(file,
              null);
}

代码示例来源:origin: kiegroup/appformer

@Test(expected = IllegalArgumentException.class)
public void visitFileNull1() {
  final Path dir = newTempDir(null);
  final Path file = Files.createTempFile(dir,
                      "foo",
                      "bar");
  simple.visitFile(null,
           Files.readAttributes(file,
                     BasicFileAttributes.class));
}

代码示例来源:origin: kiegroup/appformer

@Test
public void readAttributesGeneral() {
  final Path path = Files.createTempFile("foo", "bar");
  final BasicFileAttributesImpl attrs = Files.readAttributes(path,
                                BasicFileAttributesImpl.class);
  assertThat(attrs).isNotNull();
  assertThat(attrs.isRegularFile()).isTrue();
  assertThat(attrs.isDirectory()).isFalse();
  assertThat(attrs.isSymbolicLink()).isFalse();
  assertThat(attrs.isOther()).isFalse();
  assertThat(attrs.size()).isEqualTo(0L);
}

代码示例来源:origin: kiegroup/appformer

@Test
public void readAttributesInvalid() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThat(Files.readAttributes(path,
                  MyAttrs.class)).isNull();
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isReadable() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThat(Files.isReadable(path)).isTrue();
  assertThat(Files.isReadable(newTempDir())).isTrue();
  assertThat(Files.isReadable(Paths.get("/some/file"))).isFalse();
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isDirectory() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThat(Files.isDirectory(path)).isFalse();
  assertThat(Files.isDirectory(newTempDir())).isTrue();
  assertThat(Files.isDirectory(Paths.get("/some/file"))).isFalse();
}

相关文章