本文整理汇总了Java中java.nio.file.ProviderMismatchException类的典型用法代码示例。如果您正苦于以下问题:Java ProviderMismatchException类的具体用法?Java ProviderMismatchException怎么用?Java ProviderMismatchException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProviderMismatchException类属于java.nio.file包,在下文中一共展示了ProviderMismatchException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: move
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
public void move(Path srcPath, SecureDirectoryStream<Path> targetDir, Path targetPath)
throws IOException {
checkOpen();
JimfsPath checkedSrcPath = checkPath(srcPath);
JimfsPath checkedTargetPath = checkPath(targetPath);
if (!(targetDir instanceof JimfsSecureDirectoryStream)) {
throw new ProviderMismatchException(
"targetDir isn't a secure directory stream associated with this file system");
}
JimfsSecureDirectoryStream checkedTargetDir = (JimfsSecureDirectoryStream) targetDir;
view.copy(
checkedSrcPath,
checkedTargetDir.view,
checkedTargetPath,
ImmutableSet.<CopyOption>of(),
true);
}
示例2: resolve
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
public JimfsPath resolve(Path other) {
JimfsPath otherPath = checkPath(other);
if (otherPath == null) {
throw new ProviderMismatchException(other.toString());
}
if (isEmptyPath() || otherPath.isAbsolute()) {
return otherPath;
}
if (otherPath.isEmptyPath()) {
return this;
}
return pathService.createPath(
root,
ImmutableList.<Name>builder()
.addAll(names)
.addAll(otherPath.names)
.build());
}
示例3: resolveSibling
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
public JimfsPath resolveSibling(Path other) {
JimfsPath otherPath = checkPath(other);
if (otherPath == null) {
throw new ProviderMismatchException(other.toString());
}
if (otherPath.isAbsolute()) {
return otherPath;
}
JimfsPath parent = getParent();
if (parent == null) {
return otherPath;
}
return parent.resolve(other);
}
示例4: toCachePath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
protected LocalPath toCachePath( Path path )
{
Objects.requireNonNull( path );
if( !(path instanceof LocalPath) ) {
throw new ProviderMismatchException();
}
return (LocalPath) path.toAbsolutePath();
}
示例5: checkPath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
private P checkPath( Path path )
{
if( path == null ) {
throw new NullPointerException();
}
if( !(path instanceof AbstractPath) ) {
throw new ProviderMismatchException();
}
return (P) path;
}
示例6: toCachePath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
protected CachePath toCachePath( Path path )
{
Objects.requireNonNull( path );
if( !(path instanceof CachePath) ) {
throw new ProviderMismatchException();
}
return (CachePath) path.toAbsolutePath();
}
示例7: toPath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
protected MemoryPath toPath( Path path )
{
Objects.requireNonNull( path );
if( !(path instanceof MemoryPath) ) {
throw new ProviderMismatchException();
}
return (MemoryPath) path.toAbsolutePath();
}
示例8: toMCRPath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
public static MCRPath toMCRPath(final Path other) {
if (other == null) {
throw new NullPointerException();
}
if (!(other instanceof MCRPath)) {
throw new ProviderMismatchException("other is not an instance of MCRPath: " + other.getClass());
}
return (MCRPath) other;
}
示例9: checkPathAbsolute
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
static MCRPath checkPathAbsolute(Path path) {
MCRPath mcrPath = MCRPath.toMCRPath(path);
if (!(Objects.requireNonNull(mcrPath.getFileSystem(), "'path' requires a associated filesystem.")
.provider() instanceof MCRFileSystemProvider)) {
throw new ProviderMismatchException("Path does not match to this provider: " + path);
}
if (!mcrPath.isAbsolute()) {
throw new InvalidPathException(mcrPath.toString(), "'path' must be absolute.");
}
return mcrPath;
}
示例10: register
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
public WatchKey register(WatchService watcher,
WatchEvent.Kind<?>[] events,
WatchEvent.Modifier... modifiers)
throws IOException {
if (watcher == null) {
throw new NullPointerException();
}
if (!(watcher instanceof AbstractWatchService)) {
throw new ProviderMismatchException();
}
return ((AbstractWatchService) watcher).register(this, Arrays.asList(events));
}
示例11: getFile
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Nonnull
public static String getFile(URI uri) throws ProviderMismatchException {
checkScheme(uri);
String fragment = uri.getFragment();
if(fragment == null)
fragment = "";
if(!fragment.startsWith("/"))
fragment = "/" + fragment;
if(fragment.length() > 1 && fragment.endsWith("/"))
fragment = fragment.substring(0, fragment.length() - 1);
return fragment;
}
示例12: dismantle
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
static Path dismantle(Path mantle) {
if (mantle == null)
throw new NullPointerException();
if (!(mantle instanceof EncryptedFileSystemPath))
throw new ProviderMismatchException();
return ((EncryptedFileSystemPath) mantle).subFSPath;
}
示例13: register
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
@Override
public WatchKey register(WatchService watcher,
WatchEvent.Kind<?>[] events,
WatchEvent.Modifier... modifiers)
throws IOException {
if (watcher == null)
throw new NullPointerException();
if (!(watcher instanceof AbstractWatchService))
throw new ProviderMismatchException();
return ((AbstractWatchService) watcher).register(this, events, modifiers);
}
示例14: toEfsPath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
private EphemeralFsPath toEfsPath(Path other) {
if(other == null) {
throw new NullPointerException();
}
try
{
return (EphemeralFsPath) other;
} catch(ClassCastException e) {
throw new ProviderMismatchException();
}
}
示例15: toTarPath
import java.nio.file.ProviderMismatchException; //导入依赖的package包/类
static final TarPath toTarPath(Path path) {
if (path == null) {
throw new NullPointerException();
}
if (!(path instanceof TarPath)) {
throw new ProviderMismatchException();
}
return (TarPath) path;
}