java.nio.file.NotLinkException Java Examples

The following examples show how to use java.nio.file.NotLinkException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: dremio-oss   Author: dremio   File: FileStatusWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Path getSymbolicLink() throws IOException {
  if (!isSymbolicLink()) {
    throw new NotLinkException(status.getPath().toString());
  }
  if (symbolicLink == null) {
    symbolicLink = HadoopFileSystem.fromHadoopPath(status.getSymlink());
  }
  return symbolicLink;
}
 
Example #2
Source Project: dremio-oss   Author: dremio   File: HadoopFileStatusWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Path getSymbolicLink() throws IOException {
  if (!isSymbolicLink()) {
    throw new NotLinkException(status.getPath().toString());
  }

  return Path.of(status.getSymlink().toUri());
}
 
Example #3
Source Project: sftp-fs   Author: robtimus   File: DefaultFileSystemExceptionFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p>
 * If the {@link SftpException#id id} of the {@link SftpException} is not {@link ChannelSftp#SSH_FX_NO_SUCH_FILE} or
 * {@link ChannelSftp#SSH_FX_PERMISSION_DENIED}, this default implementation does not return a {@link FileSystemException}, but a
 * {@link NotLinkException} instead.
 */
@Override
public FileSystemException createReadLinkException(String link, SftpException exception) {
    if (exception.id == ChannelSftp.SSH_FX_NO_SUCH_FILE || exception.id == ChannelSftp.SSH_FX_PERMISSION_DENIED) {
        return asFileSystemException(link, null, exception);
    }
    final FileSystemException result = new NotLinkException(link, null, exception.getMessage());
    result.initCause(exception);
    return result;
}
 
Example #4
Source Project: buck   Author: facebook   File: FakeProjectFilesystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Path readSymLink(Path path) throws IOException {
  Path target = symLinks.get(path);
  if (target == null) {
    throw new NotLinkException(path.toString());
  }
  return target;
}
 
Example #5
Source Project: jimfs   Author: google   File: DirectoryEntry.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source Project: dremio-oss   Author: dremio   File: FileAttributes.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the symbolic link associated with the file
 *
 * @return the target path of the link
 * @throws NotLinkException if the original file is not a symbolic link
 * @throws IOException
 */
Path getSymbolicLink() throws NotLinkException, IOException;