本文整理了Java中ch.cyberduck.core.Local.attributes()
方法的一些代码示例,展示了Local.attributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.attributes()
方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:attributes
暂无
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Long getDefault(final Local file) {
return file.attributes().getModificationDate();
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Map<String, String> getDefault(final Local file) {
final Map<String, String> metadata = PreferencesFactory.get().getMap("b2.metadata.default");
metadata.put(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS, String.valueOf(file.attributes().getModificationDate()));
return metadata;
}
代码示例来源:origin: iterate-ch/cyberduck
public Map<String, Host> refresh() {
final long mtime = configuration.attributes().getModificationDate();
if(mtime != lastModified) {
try {
final InputStream in = configuration.getInputStream();
try {
hosts = this.parse(in);
}
finally {
IOUtils.closeQuietly(in);
}
}
catch(AccessDeniedException | IOException none) {
log.warn(String.format("Failure reading %s", configuration));
hosts = Collections.emptyMap();
}
lastModified = mtime;
}
return hosts;
}
代码示例来源:origin: iterate-ch/cyberduck
if(local.isFile()) {
if(parent.isExists()) {
final Write.Append append = upload.append(file, local.attributes().getSize(), cache);
if(append.size == local.attributes().getSize()) {
if(Checksum.NONE != append.checksum) {
final ChecksumCompute compute = ChecksumComputeFactory.get(append.checksum.algorithm);
if(compute.compute(local.getInputStream(), parent).equals(append.checksum)) {
if(log.isInfoEnabled()) {
log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum()));
代码示例来源:origin: iterate-ch/cyberduck
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
@Override
public Permission getDefault(final Local file) {
if(PreferencesFactory.get().getBoolean("queue.upload.permissions.default")) {
return this.getDefault(file.getType());
}
else {
// Read permissions from local file
return file.attributes().getPermission();
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
log.info(String.format("Determine if part %s can be skipped", segmentStatus));
if(segmentFile.attributes().getSize() > 0) {
segmentStatus.setAppend(true);
segmentStatus.setLength(segmentStatus.getLength() - segmentFile.attributes().getSize());
segmentStatus.setOffset(segmentStatus.getOffset() + segmentFile.attributes().getSize());
if(local.isFile()) {
if(local.exists()) {
if(local.attributes().getSize() > 0) {
status.setAppend(true);
status.setLength(status.getLength() - local.attributes().getSize());
status.setOffset(status.getOffset() + local.attributes().getSize());
status.rename((Local) null);
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void allow(final String hostname, final PublicKey key, final boolean persist) {
if(null == database) {
super.allow(hostname, key, persist);
}
else {
try {
// Add the host key to the in-memory database
final OpenSSHKnownHosts.HostEntry entry
= new OpenSSHKnownHosts.HostEntry(null, PreferencesFactory.get().getBoolean(
"ssh.knownhosts.hostname.hash") ? hash(hostname) : hostname,
KeyType.fromKey(key), key);
database.entries().add(entry);
if(persist) {
if(file.attributes().getPermission().isWritable()) {
// Also try to add the key to a known_host file
database.write(entry);
}
}
}
catch(IOException e) {
log.error(String.format("Failure adding host key to database: %s", e.getMessage()));
super.allow(hostname, key, persist);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
if(!credentials.getIdentity().attributes().getPermission().isReadable()) {
log.warn(String.format("Prompt to select identity file not readable %s", credentials.getIdentity()));
credentials.setIdentity(prompt.select(credentials.getIdentity()));
代码示例来源:origin: iterate-ch/cyberduck
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:
代码示例来源:origin: iterate-ch/cyberduck
for(TransferItem upload : roots) {
final Upload<?> write = source.getFeature(Upload.class);
final Write.Append append = write.append(upload.remote, upload.local.attributes().getSize(), cache);
if(append.override || append.append) {
代码示例来源:origin: iterate-ch/cyberduck
local.attributes().setPermission(status.getPermission());
local.attributes().setModificationDate(status.getTimestamp());
代码示例来源:origin: iterate-ch/cyberduck
if(local.attributes().getSize() == 0) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public TransferStatus prepare(final Path file, final Local local, final TransferStatus parent, final ProgressListener progress) throws BackgroundException {
final TransferStatus status = super.prepare(file, local, parent, progress);
if(file.isFile()) {
if(parent.isExists()) {
final Write.Append append = upload.append(file, status.getLength(), cache);
if(append.append && append.size < local.attributes().getSize()) {
// Append to existing file
status.setAppend(true);
status.setLength(status.getLength() - append.size);
status.setOffset(append.size);
// Disable use of temporary target when resuming upload
status.rename((Path) null);
}
}
}
return status;
}
}
代码示例来源:origin: iterate-ch/cyberduck
item.local.getAbsolute(),
TRUNCATE_MIDDLE_ATTRIBUTES));
if(item.local.attributes().getSize() == -1) {
localSizeField.setAttributedStringValue(UNKNOWN_STRING);
SizeFormatterFactory.get().format(item.local.attributes().getSize()),
TRUNCATE_MIDDLE_ATTRIBUTES));
if(item.local.attributes().getModificationDate() == -1) {
localModificationField.setAttributedStringValue(UNKNOWN_STRING);
UserDateFormatterFactory.get().getLongFormat(item.local.attributes().getModificationDate()),
TRUNCATE_MIDDLE_ATTRIBUTES));
代码示例来源:origin: iterate-ch/cyberduck
status.setLength(target.attributes().getSize());
status.setLength(local.attributes().getSize());
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Acl getDefault(final Local file) {
final Permission permission;
if(PreferencesFactory.get().getBoolean("queue.upload.permissions.default")) {
if(file.isFile()) {
permission = new Permission(
PreferencesFactory.get().getInteger("queue.upload.permissions.file.default"));
}
else {
permission = new Permission(
PreferencesFactory.get().getInteger("queue.upload.permissions.folder.default"));
}
}
else {
// Read permissions from local file
permission = file.attributes().getPermission();
}
final Acl acl = new Acl();
if(permission.getOther().implies(Permission.Action.read)) {
acl.addAll(new Acl.GroupUser(Acl.GroupUser.EVERYONE), new Acl.Role(Acl.Role.READ));
}
if(permission.getGroup().implies(Permission.Action.read)) {
acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.READ));
}
if(permission.getGroup().implies(Permission.Action.write)) {
acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.WRITE));
}
return acl;
}
}
内容来源于网络,如有侵权,请联系作者删除!