com.jcraft.jsch.ChannelSftp.symlink()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(218)

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

ChannelSftp.symlink介绍

[英]Creates a new symbolic link.

Note: The protocol draft declares the two parameters in the reverse order (i.e. first linkpath, then targetpath), but because of an erronous implementation in (both sides of) OpenSSH, the de facto protocol is now what is implemented here (first targetpath, then linkpath). If you are speaking to a SFTP server which implements the protocol as specified, you might have to swap the arguments.
[中]创建新的符号链接。
注意:协议草案以相反的顺序声明了这两个参数(即第一个linkpath,然后是targetpath),但由于OpenSSH中的错误实现,事实上的协议现在是在这里实现的(第一个targetpath,然后是linkpath)。如果您正在与实现指定协议的SFTP服务器对话,则可能需要交换参数。

代码示例

代码示例来源:origin: fizzed/blaze

@Override
public void symlink(Path target, Path link) {
  try {
    this.channel.symlink(PathHelper.toString(target), PathHelper.toString(link));
  } catch (SftpException e) {
    throw convertSftpException(e);
  }
}

代码示例来源:origin: net.oneandone/sushi

@Override
public void mklink(String target) throws LinkException {
  ChannelSftp sftp;
  try {
    checkNotExists();
    getParent().checkDirectory();
    sftp = alloc();
    try {
      sftp.symlink(target, escape(slashPath));
    } finally {
      free(sftp);
    }
  } catch (SftpException | JSchException | IOException e) {
    throw new LinkException(this, e);
  }
}

代码示例来源:origin: net.sf.beezle.sushi/sushi

@Override
public void mklink(String target) throws LinkException {
  ChannelSftp sftp;
  try {
    checkNotExists();
    getParent().checkDirectory();
    sftp = alloc();
    try {
      sftp.symlink(target, escape(slashPath));
    } finally {
      free(sftp);
    }
  } catch (SftpException e) {
    throw new LinkException(this, e);
  } catch (JSchException e) {
    throw new LinkException(this, e);
  } catch (IOException e) {
    throw new LinkException(this, e);
  }
}

相关文章

微信公众号

最新文章

更多

ChannelSftp类方法