当前位置: 首页>>代码示例>>Java>>正文


Java NotLinkException类代码示例

本文整理汇总了Java中java.nio.file.NotLinkException的典型用法代码示例。如果您正苦于以下问题:Java NotLinkException类的具体用法?Java NotLinkException怎么用?Java NotLinkException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NotLinkException类属于java.nio.file包,在下文中一共展示了NotLinkException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateOrThrow

import java.nio.file.NotLinkException; //导入依赖的package包/类
protected final int translateOrThrow(Exception exception) {
	return ExceptionTranslator.<Integer, Exception> of(exception) //
			.translate(AccessDeniedException.class, e -> -ErrorCodes.EPERM()) //
			.translate(NoSuchFileException.class, e -> -ErrorCodes.ENOENT()) //
			.translate(NotDirectoryException.class, e -> -ErrorCodes.ENOTDIR()) //
			.translate(NotLinkException.class, e -> -ErrorCodes.EINVAL()) //
			.translate(UnsupportedOperationException.class, e -> -ErrorCodes.ENOSYS()) //
			.translate(IOException.class, e -> {
				logger.warn("", e); // Unmapped IOException, log warning
				return -ErrorCodes.EIO();
			}).get();
}
 
开发者ID:tfiskgul,项目名称:mux2fs,代码行数:13,代码来源:MirrorFs.java

示例2: testAllErrors

import java.nio.file.NotLinkException; //导入依赖的package包/类
protected void testAllErrors(Try.CheckedConsumer<ExpectedResult, Exception> sut)
		throws Exception {
	List<ExpectedResult> list = list( //
			exp(new NoSuchFileException(null), -ErrorCodes.ENOENT()), //
			exp(new AccessDeniedException(null), -ErrorCodes.EPERM()), //
			exp(new NotDirectoryException(null), -ErrorCodes.ENOTDIR()), //
			exp(new NotLinkException(null), -ErrorCodes.EINVAL()), //
			exp(new UnsupportedOperationException(), -ErrorCodes.ENOSYS()), //
			exp(new IOException(), -ErrorCodes.EIO())); //
	list.forEach(expected -> Try.runWithCatch(() -> sut.accept(expected), Exception.class).get());
}
 
开发者ID:tfiskgul,项目名称:mux2fs,代码行数:12,代码来源:Fixture.java

示例3: readSymbolicLink

import java.nio.file.NotLinkException; //导入依赖的package包/类
@Override
public File readSymbolicLink(File link) throws IOException {
  if (!isSymbolicLink(link)) {
    throw new NotLinkException(link.getPath());
  }
  VirtualFile vf = fileSystem.findFile(link.getPath());
  return VfsUtil.virtualToIoFile(symlinks.get(vf));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeGoGotoDeclarationHandlerTest.java

示例4: getRawSymbolicLink

import java.nio.file.NotLinkException; //导入依赖的package包/类
public EphemeralFsPath getRawSymbolicLink(Path parent, EphemeralFsPath fileName) throws FileSystemException {
    DirectoryEntry entry = children.get(fileName.toFileName());
    if(entry == null) {
        throw new NoSuchFileException(parent.resolve(fileName).toString());
    }
    if(!entry.isSymbolicLink()) {
        throw new NotLinkException(parent.resolve(fileName).toString());
    }
    return entry.getSymbolicLink();
}
 
开发者ID:sbridges,项目名称:ephemeralfs,代码行数:11,代码来源:INode.java

示例5: testReadSymbolicLinkNoSymbolicLink

import java.nio.file.NotLinkException; //导入依赖的package包/类
@Test
public void testReadSymbolicLinkNoSymbolicLink() throws Exception {
    Path notSymLink = root.resolve("notSymLink");
    Files.createDirectories(notSymLink);
    try {
        Files.readSymbolicLink(notSymLink);
        fail();
    } catch(NotLinkException e) {
        //pass
    }
}
 
开发者ID:sbridges,项目名称:ephemeralfs,代码行数:12,代码来源:LinkTest.java

示例6: readSymLink

import java.nio.file.NotLinkException; //导入依赖的package包/类
@Override
public Path readSymLink(Path path) throws IOException {
  Path target = symLinks.get(path);
  if (target == null) {
    throw new NotLinkException(path.toString());
  }
  return target;
}
 
开发者ID:facebook,项目名称:buck,代码行数:9,代码来源:FakeProjectFilesystem.java

示例7: requireSymbolicLink

import java.nio.file.NotLinkException; //导入依赖的package包/类
/**
 * Checks that this entry exists and links to a symbolic link, throwing an exception if not.
 *
 * @return this
 * @throws NoSuchFileException if this entry does not exist
 * @throws NotLinkException if this entry does not link to a symbolic link
 */
public DirectoryEntry requireSymbolicLink(Path pathForException)
    throws NoSuchFileException, NotLinkException {
  requireExists(pathForException);
  if (!file().isSymbolicLink()) {
    throw new NotLinkException(pathForException.toString());
  }
  return this;
}
 
开发者ID:google,项目名称:jimfs,代码行数:16,代码来源:DirectoryEntry.java

示例8: testGetSymLinkOfNonLinkThrows

import java.nio.file.NotLinkException; //导入依赖的package包/类
@Test( expected = NotLinkException.class )
@Category( { SymLink.class } )
public void testGetSymLinkOfNonLinkThrows() throws IOException {
    Files.readSymbolicLink( targetFile() );
}
 
开发者ID:openCage,项目名称:niotest,代码行数:6,代码来源:Tests20SymLinks.java


注:本文中的java.nio.file.NotLinkException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。