本文整理了Java中ch.cyberduck.core.Local
类的一些代码示例,展示了Local
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local
类的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
暂无
代码示例来源:origin: iterate-ch/cyberduck
/**
* @param file A valid bookmark dictionary
* @return Null if the file cannot be deserialized
* @throws AccessDeniedException If the file is not readable
*/
@Override
public S read(final Local file) throws AccessDeniedException {
if(!file.exists()) {
throw new LocalAccessDeniedException(file.getAbsolute());
}
if(!file.isFile()) {
throw new LocalAccessDeniedException(file.getAbsolute());
}
final S deserialized = this.read(file.getInputStream());
if(null == deserialized) {
throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName()));
}
return deserialized;
}
代码示例来源:origin: iterate-ch/cyberduck
public String getLocal() {
final Local local = roots.iterator().next().local;
if(roots.size() == 1) {
return local.getAbbreviatedPath();
}
else {
return local.getParent().getAbbreviatedPath();
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Local file) {
if(file.isDirectory()) {
return true;
}
return "xml".equals(file.getExtension());
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public int compare(final Local o1, final Local o2) {
if(o1.isDirectory() && o2.isDirectory()) {
return 0;
}
if(o1.isFile() && o2.isFile()) {
return 0;
}
if(o1.isDirectory()) {
return -1;
}
if(o2.isDirectory()) {
return 1;
}
return 0;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Local file) {
if(file.isFile()) {
return "fireFTPsites.dat".equals(file.getName());
}
return false;
}
})) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void run() {
final NSOpenPanel panel = NSOpenPanel.openPanel();
panel.setCanChooseDirectories(file.isDirectory());
panel.setCanChooseFiles(file.isFile());
panel.setAllowsMultipleSelection(false);
panel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Select {0}", "Credentials"),
file.getAbbreviatedPath()));
panel.setPrompt(LocaleFactory.localizedString("Choose"));
final NSInteger modal = panel.runModal(file.getParent().getAbsolute(), file.getName());
if(modal.intValue() == SheetCallback.DEFAULT_OPTION) {
final NSArray filenames = panel.filenames();
final NSEnumerator enumerator = filenames.objectEnumerator();
NSObject next;
while((next = enumerator.nextObject()) != null) {
selected.set(new FinderLocal(next.toString()));
}
}
panel.orderOut(null);
}
};
代码示例来源:origin: iterate-ch/cyberduck
private Properties load() {
final Properties properties = new Properties();
try {
new DefaultLocalDirectoryFeature().mkdir(file.getParent());
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getDetail()));
}
if(file.exists()) {
try {
try (InputStream in = file.getInputStream()) {
properties.load(in);
}
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure reading credentials from %s. %s", file.getAbsolute(), e.getDetail()));
}
catch(IOException e) {
log.warn(String.format("Failure reading credentials from %s. %s", file.getAbsolute(), e.getMessage()));
}
}
return properties;
}
代码示例来源:origin: iterate-ch/cyberduck
public InputStream getInputStream() throws AccessDeniedException {
return this.getInputStream(path);
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void trash(Local file) throws LocalAccessDeniedException {
try {
Files.delete(Paths.get(file.getAbsolute()));
}
catch(IOException e) {
throw new LocalAccessDeniedException(String.format("Failed to move %s to Trash", file.getName()), e);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
String passphrase = this.getPassword(bookmark.getHostname(), key.getAbbreviatedPath());
if(null == passphrase) {
passphrase = this.getPassword("SSH", key.getAbsolute());
passphrase = this.getPassword("SSHKeychain", key.getAbbreviatedPath());
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
if(local.isFile()) {
if(local.exists()) {
if(local.attributes().getSize() == attributes.getSize()) {
if(Checksum.NONE != attributes.getChecksum()) {
final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm);
if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) {
if(log.isInfoEnabled()) {
log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum()));
log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize()));
代码示例来源:origin: iterate-ch/cyberduck
for(TransferItem download : roots) {
final Local local = download.local;
if(local.exists()) {
if(local.isDirectory()) {
if(local.list().isEmpty()) {
if(local.isFile()) {
if(local.attributes().getSize() == 0) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void load() throws AccessDeniedException {
if(log.isInfoEnabled()) {
log.info(String.format("Reloading %s", folder.getAbsolute()));
if(!folder.exists()) {
new DefaultLocalDirectoryFeature().mkdir(folder);
final AttributedList<Local> transfers = folder.list().filter(
new Filter<Local>() {
@Override
final Transfer transfer = reader.read(f);
if(!this.getFile(transfer).equals(f)) {
this.rename(f, transfer);
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean open(final Local file) {
try {
runtime.exec(String.format("xdg-open %s", file.getAbsolute()));
return true;
}
catch(IOException e) {
log.warn(String.format("Failure launching application %s", e.getMessage()));
return false;
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected boolean matches(final Local context, final Local file) {
if(!new File(context.getAbsolute()).isAbsolute()) {
return context.getName().equals(file.getName());
}
return this.normalize(context).equals(this.normalize(file));
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
final Local volume = local.getVolume();
if(!volume.exists()) {
throw new NotfoundException(String.format("Volume %s not mounted", volume.getAbsolute()));
}
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void load() throws AccessDeniedException {
if(log.isInfoEnabled()) {
log.info(String.format("Reloading %s", folder.getAbsolute()));
if(!folder.exists()) {
new DefaultLocalDirectoryFeature().mkdir(folder);
final AttributedList<Local> bookmarks = folder.list().filter(
new Filter<Local>() {
@Override
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
if(!local.exists()) {
// Local file is no more here
throw new NotfoundException(local.getAbsolute());
}
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public List<TransferItem> list(final Session<?> session, final Path remote,
final Local directory, final ListProgressListener listener) throws BackgroundException {
if(log.isDebugEnabled()) {
log.debug(String.format("List children for %s", directory));
}
if(directory.isSymbolicLink()) {
final Symlink symlink = session.getFeature(Symlink.class);
if(new UploadSymlinkResolver(symlink, roots).resolve(directory)) {
if(log.isDebugEnabled()) {
log.debug(String.format("Do not list children for symbolic link %s", directory));
}
// We can resolve the target of the symbolic link and will create a link on the remote system
// using the symlink feature of the session
return Collections.emptyList();
}
}
final List<TransferItem> children = new ArrayList<TransferItem>();
for(Local local : directory.list().filter(comparator, filter)) {
children.add(new TransferItem(new Path(remote, local.getName(),
local.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), local));
}
return children;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Comparison compare(final Path file, final Local local) throws BackgroundException {
if(local.exists()) {
if(finder.withCache(cache).find(file)) {
if(file.isDirectory()) {
switch(size.compare(attributes, local.attributes())) {
case remote:
return Comparison.remote;
local.attributes().setChecksum(ChecksumComputeFactory.get(attributes.getChecksum().algorithm)
.compute(local.getInputStream(), new TransferStatus()));
switch(checksum.compare(attributes, local.attributes())) {
case equal:
final Comparison compare = timestamp.compare(attributes, local.attributes());
switch(compare) {
case unknown:
switch(size.compare(attributes, local.attributes())) {
case local:
case notequal:
内容来源于网络,如有侵权,请联系作者删除!