Java Code Examples for com.jcraft.jsch.SftpATTRS#SSH_FILEXFER_ATTR_SIZE

The following examples show how to use com.jcraft.jsch.SftpATTRS#SSH_FILEXFER_ATTR_SIZE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSftpProviderTestCase.java    From commons-vfs with Apache License 2.0 6 votes vote down vote up
private SftpAttrs(final Buffer buf) {
    int flags = 0;
    flags = buf.getInt();

    if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) != 0) {
        size = buf.getLong();
    }
    if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_UIDGID) != 0) {
        uid = buf.getInt();
        gid = buf.getInt();
    }
    if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) {
        permissions = buf.getInt();
    }
    if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_ACMODTIME) != 0) {
        atime = buf.getInt();
    }
    if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_ACMODTIME) != 0) {
        mtime = buf.getInt();
    }

}
 
Example 2
Source File: SftpResourceAccessor.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private ExternalResourceMetaData toMetaData(URI uri, SftpATTRS attributes) {
    long lastModified = -1;
    long contentLength = -1;

    if ((attributes.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_ACMODTIME) != 0) {
        lastModified = attributes.getMTime() * 1000;
    }
    if ((attributes.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) != 0) {
        contentLength = attributes.getSize();
    }

    return new DefaultExternalResourceMetaData(uri, lastModified, contentLength, null, null);
}
 
Example 3
Source File: SftpResourceAccessor.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private ExternalResourceMetaData toMetaData(URI uri, SftpATTRS attributes) {
    long lastModified = -1;
    long contentLength = -1;

    if ((attributes.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_ACMODTIME) != 0) {
        lastModified = attributes.getMTime() * 1000;
    }
    if ((attributes.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) != 0) {
        contentLength = attributes.getSize();
    }

    return new DefaultExternalResourceMetaData(uri, lastModified, contentLength, null, null);
}
 
Example 4
Source File: SftpFileObject.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the size of the file content (in bytes).
 */
@Override
protected long doGetContentSize() throws Exception {
    if (attrs == null || (attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) == 0) {
        throw new FileSystemException("vfs.provider.sftp/unknown-size.error");
    }
    return attrs.getSize();
}