public class SftpATTRS extends Object
flags
field defines which attributes
are present in the structure, and then only these follow.
This class manages the flags automatically, the setXXX methods also set the corresponding flag.
When changing attributes using
ChannelSftp.setStat()
, only these
attributes actually contained in the structure are sent to the
server and will be changed.
This class corresponds to the ATTRS structure in the form defined in version 00-02 of the Internet draft SSH File Transfer Protocol, corresponding to version 3 of the SSH File transfer protocol. (Later versions changed the format, and there is no version actually published as RFC.)
Here is a quote from the specification:uint32 flags uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE uint32 uid present only if flag SSH_FILEXFER_ATTR_UIDGID uint32 gid present only if flag SSH_FILEXFER_ATTR_UIDGID uint32 permissions present only if flag SSH_FILEXFER_ATTR_PERMISSIONS uint32 atime present only if flag SSH_FILEXFER_ACMODTIME uint32 mtime present only if flag SSH_FILEXFER_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
ChannelSftp
,
stat()
,
lstat()
,
setStat()
Modifier and Type | Field and Description |
---|---|
static int |
SSH_FILEXFER_ATTR_ACMODTIME
|
static int |
SSH_FILEXFER_ATTR_EXTENDED
Flag indicating the presence of
extended attributes.
|
static int |
SSH_FILEXFER_ATTR_PERMISSIONS
Flag indicating the presence of the
permissions
attribute. |
static int |
SSH_FILEXFER_ATTR_SIZE
Flag indicating the presence of the
size
attribute. |
static int |
SSH_FILEXFER_ATTR_UIDGID
|
Modifier and Type | Method and Description |
---|---|
int |
getATime()
returns the last access time.
|
String |
getAtimeString()
returns a string representation of the access time.
|
String[] |
getExtended()
returns extended attributes, if any.
|
int |
getFlags()
returns the flags indicating which attributes
are present.
|
int |
getGId()
returns the numerical group identifier of the owning group.
|
int |
getMTime()
returns the last modification time.
|
String |
getMtimeString()
returns a string representation of the modifiying time.
|
int |
getPermissions()
Returns the Unix permissions of the file.
|
String |
getPermissionsString()
Returns a string representation of the permissions
in the format used by
ls -l . |
long |
getSize()
Returns the size of the file, in bytes.
|
int |
getUId()
returns the numerical user identifier of the owning user.
|
boolean |
isBlk() |
boolean |
isChr() |
boolean |
isDir()
checks whether this file is a directory.
|
boolean |
isFifo() |
boolean |
isLink()
checks whether this file is a symbolic link.
|
boolean |
isReg() |
boolean |
isSock() |
void |
setACMODTIME(int atime,
int mtime)
Sets access and modification time.
|
void |
setPERMISSIONS(int permissions)
sets the file permissions.
|
void |
setSIZE(long size)
sets the size.
|
void |
setUIDGID(int uid,
int gid)
Sets user and group Identifier.
|
String |
toString()
creates a string representation of this object.
|
public static final int SSH_FILEXFER_ATTR_SIZE
size
attribute.public static final int SSH_FILEXFER_ATTR_UIDGID
public static final int SSH_FILEXFER_ATTR_PERMISSIONS
permissions
attribute.public static final int SSH_FILEXFER_ATTR_ACMODTIME
public static final int SSH_FILEXFER_ATTR_EXTENDED
public String getPermissionsString()
ls -l
.public String getAtimeString()
public String getMtimeString()
public void setSIZE(long size)
public void setUIDGID(int uid, int gid)
public void setACMODTIME(int atime, int mtime)
public void setPERMISSIONS(int permissions)
permissions
- a bit mask containing some combination
of the bits 0-11.public boolean isReg()
public boolean isDir()
public boolean isChr()
public boolean isBlk()
public boolean isFifo()
public boolean isLink()
public boolean isSock()
public int getFlags()
public long getSize()
public int getUId()
The `uid' and `gid' fields contain numeric Unix-like user and group identifiers, respectively.
public int getGId()
The `uid' and `gid' fields contain numeric Unix-like user and group identifiers, respectively.
public int getPermissions()
The `permissions' field contains a bit mask of file permissions as defined by posix.
public int getATime()
The `atime' and `mtime' contain the access and modification times of the files, respectively. They are represented as seconds from Jan 1, 1970 in UTC.
public int getMTime()
The `atime' and `mtime' contain the access and modification times of the files, respectively. They are represented as seconds from Jan 1, 1970 in UTC.
public String[] getExtended()
This is a simplified version of the inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.