本文整理汇总了Java中com.trilead.ssh2.sftp.AttribFlags类的典型用法代码示例。如果您正苦于以下问题:Java AttribFlags类的具体用法?Java AttribFlags怎么用?Java AttribFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttribFlags类属于com.trilead.ssh2.sftp包,在下文中一共展示了AttribFlags类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mkdir
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
/**
* Create a new directory.
*
* @param dirName See the {@link SFTPv3Client comment} for the class for more details.
* @param posixPermissions the permissions for this directory, e.g., "0700" (remember that
* this is octal noation). The server will likely apply a umask.
*
* @throws IOException
*/
public void mkdir(String dirName, int posixPermissions) throws IOException
{
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(dirName, charsetName);
tw.writeUINT32(AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS);
tw.writeUINT32(posixPermissions);
sendMessage(Packet.SSH_FXP_MKDIR, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
开发者ID:dragonlinux,项目名称:connectbot,代码行数:23,代码来源:SFTPv3Client.java
示例2: readAttrs
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
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,代码行数:72,代码来源:SFTPv3Client.java
示例3: createAttrs
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
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,代码行数:48,代码来源:SFTPv3Client.java
示例4: createAttrs
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
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,代码行数:44,代码来源:SFTPv3Client.java
示例5: readAttrs
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
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,代码行数:63,代码来源:SFTPv3Client.java
示例6: mkdir
import com.trilead.ssh2.sftp.AttribFlags; //导入依赖的package包/类
/**
* Create a new directory.
*
* @param dirName
* See the {@link SFTPv3Client comment} for the class for more
* details.
* @param posixPermissions
* the permissions for this directory, e.g., "0700" (remember
* that this is octal noation). The server will likely apply a
* umask.
*
* @throws IOException
*/
public void mkdir(String dirName, int posixPermissions) throws IOException {
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(dirName, charsetName);
tw.writeUINT32(AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS);
tw.writeUINT32(posixPermissions);
sendMessage(Packet.SSH_FXP_MKDIR, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:26,代码来源:SFTPv3Client.java
注:本文中的com.trilead.ssh2.sftp.AttribFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论