本文整理了Java中ch.cyberduck.core.Local.setBookmark()
方法的一些代码示例,展示了Local.setBookmark()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.setBookmark()
方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:setBookmark
暂无
代码示例来源:origin: iterate-ch/cyberduck
public Local withBookmark(final String data) {
this.setBookmark(data);
return this;
}
代码示例来源:origin: iterate-ch/cyberduck
public <T> Local deserialize(T serialized) {
final Deserializer dict = deserializer.create(serialized);
final String path = dict.stringForKey("Path");
if(StringUtils.isBlank(path)) {
return null;
}
final Local file = LocalFactory.get(path);
if(StringUtils.isNotBlank(dict.stringForKey(String.format("%s Bookmark", PreferencesFactory.get().getProperty("application.name"))))) {
file.setBookmark(dict.stringForKey(String.format("%s Bookmark", PreferencesFactory.get().getProperty("application.name"))));
}
else {
if(StringUtils.isNotBlank(dict.stringForKey("Bookmark"))) {
file.setBookmark(dict.stringForKey("Bookmark"));
}
}
return file;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public NSURL resolve(final Local file, final boolean interactive) throws AccessDeniedException {
final NSData bookmark;
if(null == file.getBookmark()) {
log.warn(String.format("Missing security scoped bookmark for file %s", file));
if(interactive) {
// Prompt user if no bookmark reference is available
final String reference = this.choose(file);
file.setBookmark(reference);
bookmark = NSData.dataWithBase64EncodedString(reference);
}
else {
throw new LocalAccessDeniedException(String.format("No security scoped bookmark for %s", file.getName()));
}
}
else {
bookmark = NSData.dataWithBase64EncodedString(file.getBookmark());
}
final ObjCObjectByReference error = new ObjCObjectByReference();
final NSURL resolved = NSURL.URLByResolvingBookmarkData(bookmark, resolve, error);
if(null == resolved) {
log.warn(String.format("Error resolving bookmark for %s to URL", file));
final NSError f = error.getValueAs(NSError.class);
if(null == f) {
throw new LocalAccessDeniedException(file.getAbsolute());
}
throw new LocalAccessDeniedException(String.format("%s", f.localizedDescription()));
}
return resolved;
}
内容来源于网络,如有侵权,请联系作者删除!