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

x33g5p2x  于2022-01-26 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(104)

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

Path.resolveSibling介绍

暂无

代码示例

代码示例来源:origin: org.uberfire/uberfire-commons-editor-backend

private Path getMainPath(Path path) {
  return path.resolveSibling(util.getFileName(path).substring(1));
}

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

public static Path undot(final Path path) {
  if (!path.getFileName().toString().startsWith(".")) {
    return path;
  }
  return path.resolveSibling(path.getFileName().toString().substring(1));
}

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

public static Path dot(final Path path) {
  if (path.getFileName() == null) {
    return path.resolve(".root");
  }
  return path.resolveSibling("." + path.getFileName());
}

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

public static Path dot(final Path path) {
  if (path.getFileName() == null) {
    return path.resolve(".root");
  }
  return path.resolveSibling("." + path.getFileName());
}

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

@Test
public void resolveSiblingPath() {
  final Path path = GeneralPathImpl.create(fs,
                       "/path/to/file.txt",
                       false);
  assertThatThrownBy(() -> path.resolveSibling((Path) null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'other' should be not null!");
}

代码示例来源:origin: org.uberfire/uberfire-commons-editor-backend

public Path buildTargetPath(Path originalPath,
              String targetFileName) {
  final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath);
  String extension = "";
  if (!Files.isDirectory(_originalPath)) {
    extension = getExtension(originalPath.getFileName());
  }
  return Paths.convert(_originalPath.resolveSibling(targetFileName + extension));
}

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

public Path buildTargetPath(Path originalPath,
              String targetFileName) {
  final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath);
  String extension = "";
  if (!Files.isDirectory(_originalPath)) {
    extension = getExtension(originalPath.getFileName());
  }
  return Paths.convert(_originalPath.resolveSibling(targetFileName + extension));
}

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

@Test(expected = NoSuchFileException.class)
  public void readAttributesNoSuchFileException() {
    final Path path = getDirectoryPath().resolveSibling("somethingXXX");

    ioService().deleteIfExists(path);

    ioService().readAttributes(path);
  }
}

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

@Test(expected = NoSuchFileException.class)
  public void readAttributesNoSuchFileException() {
    final Path path = getDirectoryPath().resolveSibling("somethingXXX");

    ioService().deleteIfExists(path);

    ioService().readAttributes(path);
  }
}

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

@Test(expected = FileAlreadyExistsException.class)
public void createDirectoryFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("otherDir");
  ioService().deleteIfExists(path);
  ioService().createDirectory(path);
  ioService().createDirectory(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void createDirectoryFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("otherDir");
  ioService().deleteIfExists(path);
  ioService().createDirectory(path);
  ioService().createDirectory(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void newByteChannelFileAlreadyExistsException() {
  final Path path = getFilePath().resolveSibling("alreadyExists.txt");
  ioService().deleteIfExists(path);
  ioService().write(path,
           "ooooo!");
  ioService().newByteChannel(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void newByteChannelFileAlreadyExistsException() {
  final Path path = getFilePath().resolveSibling("alreadyExists.txt");
  ioService().deleteIfExists(path);
  ioService().write(path,
           "ooooo!");
  ioService().newByteChannel(path);
}

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

@Test(expected = DirectoryNotEmptyException.class)
public void deleteIfExistsDirectoryNotEmptyException() {
  final Path path = getDirectoryPath().resolveSibling("dirToBugIfExists");
  ioService().createDirectories(path);
  ioService().write(path.resolve("myFile.txt"),
           "ooooo!");
  ioService().deleteIfExists(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void createDirectoriesFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("otherDir").resolve("innerDir");
  ioService().deleteIfExists(path);
  ioService().createDirectories(path);
  ioService().createDirectories(path);
}

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

@Test(expected = DirectoryNotEmptyException.class)
public void deleteDirectoryNotEmptyException() {
  final Path path = getDirectoryPath().resolveSibling("dirToBug");
  ioService().createDirectories(path);
  ioService().write(path.resolve("myFile.txt"),
           "ooooo!");
  ioService().delete(path);
}

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

@Test(expected = DirectoryNotEmptyException.class)
public void deleteDirectoryNotEmptyException() {
  final Path path = getDirectoryPath().resolveSibling("dirToBug");
  ioService().createDirectories(path);
  ioService().write(path.resolve("myFile.txt"),
           "ooooo!");
  ioService().delete(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void createDirectoriesFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("otherDir").resolve("innerDir");
  ioService().deleteIfExists(path);
  ioService().createDirectories(path);
  ioService().createDirectories(path);
}

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

@Test(expected = FileAlreadyExistsException.class)
public void copyFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("alreadyExistsTest");
  ioService().deleteIfExists(path);
  ioService().createDirectories(path);
  ioService().write(path.resolve("myFile.txt"),
           "ooooo!");
  ioService().write(path.resolve("mytarget"),
           "xooooo!");
  ioService().copy(path.resolve("myFile.txt"),
           path.resolve("mytarget"));
}

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

@Test(expected = FileAlreadyExistsException.class)
public void copyFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling("alreadyExistsTest");
  ioService().deleteIfExists(path);
  ioService().createDirectories(path);
  ioService().write(path.resolve("myFile.txt"),
           "ooooo!");
  ioService().write(path.resolve("mytarget"),
           "xooooo!");
  ioService().copy(path.resolve("myFile.txt"),
           path.resolve("mytarget"));
}

相关文章