当前位置: 首页>>代码示例>>Java>>正文


Java属性com.trilead.ssh2.sftp.AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID代码示例

以下是Java属性com.trilead.ssh2.sftp.AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID的代码示例。如果您正苦于以下问题:Java AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID属性的具体用法?Java AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID怎么用?Java AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID使用的例子?那么恭喜您, 这里整理的属性代码示例例程将为您提供帮助。您也可以进一步了解该方法所在com.trilead.ssh2.sftp.AttribFlags的用法示例。

本文一共展示了AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID的4个开源代码实例,这些例子默认根据受欢迎程度排序。您可以为喜欢的代码打CALL点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readAttrs

private SFTPv3FileAttributes readAttrs(TypesReader tr) throws IOException
{
	/*
	 * uint32   flags
	 * uint64   size           present only if flag SSH_FILEXFER_ATTR_SIZE
	 * uint32   uid            present only if flag SSH_FILEXFER_ATTR_V3_UIDGID
	 * uint32   gid            present only if flag SSH_FILEXFER_ATTR_V3_UIDGID
	 * uint32   permissions    present only if flag SSH_FILEXFER_ATTR_PERMISSIONS
	 * uint32   atime          present only if flag SSH_FILEXFER_ATTR_V3_ACMODTIME
	 * uint32   mtime          present only if flag SSH_FILEXFER_ATTR_V3_ACMODTIME
	 * uint32   extended_count present only if flag SSH_FILEXFER_ATTR_EXTENDED
	 * string   extended_type
	 * string   extended_data
	 * ...      more extended data (extended_type - extended_data pairs),
	 *          so that number of pairs equals extended_count
	 */

	SFTPv3FileAttributes fa = new SFTPv3FileAttributes();

	int flags = tr.readUINT32();

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SIZE) != 0)
	{
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_SIZE");
		fa.size = new Long(tr.readUINT64());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID) != 0)
	{
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_V3_UIDGID");
		fa.uid = new Integer(tr.readUINT32());
		fa.gid = new Integer(tr.readUINT32());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS) != 0)
	{
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_PERMISSIONS");
		fa.permissions = new Integer(tr.readUINT32());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_V3_ACMODTIME) != 0)
	{
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_V3_ACMODTIME");
		fa.atime = new Long(((long)tr.readUINT32()) & 0xffffffffl);
		fa.mtime = new Long(((long)tr.readUINT32()) & 0xffffffffl);

	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_EXTENDED) != 0)
	{
		int count = tr.readUINT32();

		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_EXTENDED (" + count + ")");

		/* Read it anyway to detect corrupt packets */

		while (count > 0)
		{
			tr.readByteString();
			tr.readByteString();
			count--;
		}
	}

	return fa;
}
 
开发者ID:dragonlinux,项目:connectbot,完整代码来源:SFTPv3Client.java


示例2: createAttrs

private byte[] createAttrs(SFTPv3FileAttributes attr)
{
	TypesWriter tw = new TypesWriter();

	int attrFlags = 0;

	if (attr == null)
	{
		tw.writeUINT32(0);
	}
	else
	{
		if (attr.size != null)
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_SIZE;

		if ((attr.uid != null) && (attr.gid != null))
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID;

		if (attr.permissions != null)
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS;

		if ((attr.atime != null) && (attr.mtime != null))
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_V3_ACMODTIME;

		tw.writeUINT32(attrFlags);

		if (attr.size != null)
			tw.writeUINT64(attr.size.longValue());

		if ((attr.uid != null) && (attr.gid != null))
		{
			tw.writeUINT32(attr.uid.intValue());
			tw.writeUINT32(attr.gid.intValue());
		}

		if (attr.permissions != null)
			tw.writeUINT32(attr.permissions.intValue());

		if ((attr.atime != null) && (attr.mtime != null))
		{
			tw.writeUINT32(attr.atime.intValue());
			tw.writeUINT32(attr.mtime.intValue());
		}
	}

	return tw.getBytes();
}
 
开发者ID:dragonlinux,项目:connectbot,完整代码来源:SFTPv3Client.java


示例3: createAttrs

private byte[] createAttrs(SFTPv3FileAttributes attr) {
	TypesWriter tw = new TypesWriter();

	int attrFlags = 0;

	if (attr == null) {
		tw.writeUINT32(0);
	} else {
		if (attr.size != null)
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_SIZE;

		if ((attr.uid != null) && (attr.gid != null))
			attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID;

		if (attr.permissions != null)
			attrFlags = attrFlags
					| AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS;

		if ((attr.atime != null) && (attr.mtime != null))
			attrFlags = attrFlags
					| AttribFlags.SSH_FILEXFER_ATTR_V3_ACMODTIME;

		tw.writeUINT32(attrFlags);

		if (attr.size != null)
			tw.writeUINT64(attr.size.longValue());

		if ((attr.uid != null) && (attr.gid != null)) {
			tw.writeUINT32(attr.uid.intValue());
			tw.writeUINT32(attr.gid.intValue());
		}

		if (attr.permissions != null)
			tw.writeUINT32(attr.permissions.intValue());

		if ((attr.atime != null) && (attr.mtime != null)) {
			tw.writeUINT32(attr.atime.intValue());
			tw.writeUINT32(attr.mtime.intValue());
		}
	}

	return tw.getBytes();
}
 
开发者ID:jianlinwei,项目:sshtunnel,完整代码来源:SFTPv3Client.java


示例4: readAttrs

private SFTPv3FileAttributes readAttrs(TypesReader tr) throws IOException {
	/*
	 * uint32 flags uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE
	 * uint32 uid present only if flag SSH_FILEXFER_ATTR_V3_UIDGID uint32
	 * gid present only if flag SSH_FILEXFER_ATTR_V3_UIDGID uint32
	 * permissions present only if flag SSH_FILEXFER_ATTR_PERMISSIONS uint32
	 * atime present only if flag SSH_FILEXFER_ATTR_V3_ACMODTIME uint32
	 * mtime present only if flag SSH_FILEXFER_ATTR_V3_ACMODTIME uint32
	 * extended_count present only if flag SSH_FILEXFER_ATTR_EXTENDED string
	 * extended_type string extended_data ... more extended data
	 * (extended_type - extended_data pairs), so that number of pairs equals
	 * extended_count
	 */

	SFTPv3FileAttributes fa = new SFTPv3FileAttributes();

	int flags = tr.readUINT32();

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SIZE) != 0) {
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_SIZE");
		fa.size = new Long(tr.readUINT64());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_V3_UIDGID) != 0) {
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_V3_UIDGID");
		fa.uid = new Integer(tr.readUINT32());
		fa.gid = new Integer(tr.readUINT32());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) {
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_PERMISSIONS");
		fa.permissions = new Integer(tr.readUINT32());
	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_V3_ACMODTIME) != 0) {
		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_V3_ACMODTIME");
		fa.atime = new Long(tr.readUINT32() & 0xffffffffl);
		fa.mtime = new Long(tr.readUINT32() & 0xffffffffl);

	}

	if ((flags & AttribFlags.SSH_FILEXFER_ATTR_EXTENDED) != 0) {
		int count = tr.readUINT32();

		if (debug != null)
			debug.println("SSH_FILEXFER_ATTR_EXTENDED (" + count + ")");

		/* Read it anyway to detect corrupt packets */

		while (count > 0) {
			tr.readByteString();
			tr.readByteString();
			count--;
		}
	}

	return fa;
}
 
开发者ID:jianlinwei,项目:sshtunnel,完整代码来源:SFTPv3Client.java



注:本文示例均筛选自Github平台上各路大神开发的开源项目,代码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。