ch.cyberduck.core.Path.getAbsolute()方法的使用及代码示例

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

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

Path.getAbsolute介绍

暂无

代码示例

代码示例来源:origin: iterate-ch/cyberduck

protected Path expand(final Path remote, final String format) {
    if(remote.getAbsolute().startsWith(format)) {
      return new Path(StringUtils.replaceOnce(remote.getAbsolute(), format, workdir.getAbsolute()),
          remote.getType());
    }
    return remote;
  }
}

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @return the path relative to its parent directory
 */
@Override
public String getName() {
  if(this.isRoot()) {
    return String.valueOf(DELIMITER);
  }
  final String abs = this.getAbsolute();
  int index = abs.lastIndexOf(DELIMITER);
  return abs.substring(index + 1);
}

代码示例来源:origin: iterate-ch/cyberduck

private List<Path> findObjectsAsPaths(final Path workdir, final Predicate<MantaObject> searchPredicate) {
  return session.getClient().find(workdir.getAbsolute(), searchPredicate)
    .map(adapter::toPath)
    .collect(Collectors.toList());
}

代码示例来源:origin: iterate-ch/cyberduck

public OneDriveFolder toFolder(final Path file, final boolean resolveLastItem) throws BackgroundException {
  final OneDriveItem item = this.toItem(file, resolveLastItem);
  if(!(item instanceof OneDriveFolder)) {
    throw new NotfoundException(String.format("%s is not a folder.", file.getAbsolute()));
  }
  return (OneDriveFolder) item;
}

代码示例来源:origin: iterate-ch/cyberduck

public OneDriveFile toFile(final Path file, final boolean resolveLastItem) throws BackgroundException {
  final OneDriveItem item = this.toItem(file, resolveLastItem);
  if(!(item instanceof OneDriveFile)) {
    throw new NotfoundException(String.format("%s is not a file.", file.getAbsolute()));
  }
  return (OneDriveFile) item;
}

代码示例来源:origin: iterate-ch/cyberduck

public SimplePathPredicate(final Path file) {
  this.file = file;
  this.type = file.isSymbolicLink() ? Path.Type.symboliclink : file.isFile() ? Path.Type.file : Path.Type.directory;
  this.path = file.getAbsolute();
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public boolean find(final Path file) {
    return session.getClient().existsAndIsAccessible(file.getAbsolute());
  }
}

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param path Filename
 * @return Unarchive command
 */
public String getDecompressCommand(final Path path) {
  return MessageFormat.format(preferences.getProperty(String.format("archive.command.expand.%s", this.getIdentifier())),
      this.escape(path.getAbsolute()), this.escape(path.getParent().getAbsolute()));
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public <T> T serialize(final Serializer dict) {
  dict.setStringForKey(String.valueOf(type), "Type");
  dict.setStringForKey(this.getAbsolute(), "Remote");
  if(symlink != null) {
    dict.setObjectForKey(symlink, "Symbolic Link");
  }
  dict.setObjectForKey(attributes, "Attributes");
  return dict.getSerialized();
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public void symlink(final Path file, String target) throws BackgroundException {
    try {
      session.sftp().symlink(target, file.getAbsolute());
    }
    catch(IOException e) {
      throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file);
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public InputStream execute() throws BackgroundException {
    try {
      return session.getClient().retrieveFileStream(file.getAbsolute());
    }
    catch(IOException e) {
      throw new FTPExceptionMappingService().map(e);
    }
  }
}, new DisabledProgressListener());

代码示例来源:origin: iterate-ch/cyberduck

@Override
public void setUnixOwner(final Path file, final String owner) throws BackgroundException {
  final FileAttributes attr = new FileAttributes.Builder()
      .withUIDGID(new Integer(owner), 0)
      .build();
  try {
    session.sftp().setAttributes(file.getAbsolute(), attr);
  }
  catch(IOException e) {
    throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public DescriptiveUrlBag toUrl(final Path file) {
  final DescriptiveUrlBag list = new DescriptiveUrlBag();
  final DescriptiveUrl base = this.toUrl();
  list.add(new DescriptiveUrl(URI.create(String.format("%s%s", base.getUrl(), URIEncoder.encode(
    PathNormalizer.normalize(PathRelativizer.relativize(PathNormalizer.normalize(host.getDefaultPath(), true), file.getAbsolute()))
    ))).normalize(),
      base.getType(),
      base.getHelp())
  );
  return list;
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public PathAttributes find(final Path file) throws BackgroundException {
  try {
    final Metadata metadata = new DbxUserFilesRequests(session.getClient()).getMetadata(file.getAbsolute());
    return this.toAttributes(metadata);
  }
  catch(DbxException e) {
    throw new DropboxExceptionMappingService().map("Failure to read attributes of {0}", e, file);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public void symlink(Path file, String target) throws BackgroundException {
    try {
      if(!session.getClient().sendSiteCommand(String.format("SYMLINK %s %s", file.getAbsolute(), target))) {
        throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
      }
    }
    catch(IOException e) {
      throw new FTPExceptionMappingService().map("Cannot create file {0}", e, file);
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

private void addNavigation(final Path p) {
  pathPopupButton.addItemWithTitle(p.getAbsolute());
  pathPopupButton.lastItem().setRepresentedObject(p.getAbsolute());
  if(p.isVolume()) {
    pathPopupButton.lastItem().setImage(IconCacheFactory.<NSImage>get().volumeIcon(pool.getHost().getProtocol(), 16));
  }
  else {
    pathPopupButton.lastItem().setImage(IconCacheFactory.<NSImage>get().fileIcon(p, 16));
  }
}

代码示例来源:origin: iterate-ch/cyberduck

protected boolean isWorldReadable(final MantaObject object) {
  final MantaAccountHomeInfo accountHomeInfo = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath());
  return StringUtils.startsWithAny(
    object.getPath(),
    accountHomeInfo.getAccountPublicRoot().getAbsolute());
}

代码示例来源:origin: iterate-ch/cyberduck

public GotoController(final BrowserController parent, final Cache<Path> cache) {
  this.parent = parent;
  this.cache = cache;
  folderCombobox = NSComboBox.textfieldWithFrame(new NSRect(0, 26));
  folderCombobox.setCompletes(true);
  folderCombobox.setUsesDataSource(true);
  folderComboboxModel = new FolderComboboxModel(parent.workdir());
  folderCombobox.setDataSource(folderComboboxModel.id());
  folderCombobox.setStringValue(parent.workdir().getAbsolute());
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    final CreateFolderResult result = new DbxUserFilesRequests(session.getClient()).createFolderV2(folder.getAbsolute(), false);
    return new Path(folder.getParent(), folder.getName(), folder.getType(),
      new DropboxAttributesFinderFeature(session).toAttributes(result.getMetadata()));
  }
  catch(DbxException e) {
    throw new DropboxExceptionMappingService().map(e);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    if(!session.getClient().makeDirectory(folder.getAbsolute())) {
      throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
    }
  }
  catch(IOException e) {
    throw new FTPExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
  return new Path(folder.getParent(), folder.getName(), folder.getType(), new DefaultAttributesFinderFeature(session).find(folder));
}

相关文章