public class SftpFileAttributes extends Object
Modifier and Type | Field and Description |
---|---|
static int |
S_IFBLK
Permissions flag: Identifies the file as a block special file
|
static int |
S_IFCHR
Permissions flag: Identifies the file as a character device
|
static int |
S_IFDIR
Permissions flag: Identifies the file as a directory
|
static int |
S_IFIFO
Permissions flag: Identifies the file as a pipe
|
static int |
S_IFLNK
Permissions flag: Identifies the file as a symbolic link
|
static int |
S_IFMT
Permissions flag: Format mask constant can be used to mask off a file
type from the mode.
|
static int |
S_IFREG
Permissions flag: Identifies the file as a regular file
|
static int |
S_IFSOCK
Permissions flag: Identifies the file as a socket
|
static int |
S_IRGRP
Permissions flag: Permits a file's group to read the file.
|
static int |
S_IROTH
Permissions flag: Permits others to read the file.
|
static int |
S_IRUSR
Permissions flag: Permits the owner of a file to read the file.
|
static int |
S_ISGID
Permissions flag: Bit to determine whether a file is executed as the
group owner
|
static int |
S_ISUID
Permissions flag: Bit to determine whether a file is executed as the
owner
|
static int |
S_IWGRP
Permissions flag: Permits a file's group to write to the file.
|
static int |
S_IWOTH
Permissions flag: Permits others to write to the file.
|
static int |
S_IWUSR
Permissions flag: Permits the owner of a file to write to the file.
|
static int |
S_IXGRP
Permissions flag: Permits a file's group to execute the file or to search
the file's directory.
|
static int |
S_IXOTH
Permissions flag: Permits others to execute the file or to search the
file's directory.
|
static int |
S_IXUSR
Permissions flag: Permits the owner of a file to execute the file or to
search the file's directory.
|
static int |
S_MODE_MASK |
static int |
SSH_FILEXFER_TYPE_BLOCK_DEVICE |
static int |
SSH_FILEXFER_TYPE_CHAR_DEVICE |
static int |
SSH_FILEXFER_TYPE_DIRECTORY |
static int |
SSH_FILEXFER_TYPE_FIFO |
static int |
SSH_FILEXFER_TYPE_REGULAR |
static int |
SSH_FILEXFER_TYPE_SOCKET |
static int |
SSH_FILEXFER_TYPE_SPECIAL |
static int |
SSH_FILEXFER_TYPE_SYMLINK |
static int |
SSH_FILEXFER_TYPE_UNKNOWN |
Constructor and Description |
---|
SftpFileAttributes(int version,
String charset,
ByteArrayReader bar) |
SftpFileAttributes(String charset)
Creates a new FileAttributes object.
|
Modifier and Type | Method and Description |
---|---|
UnsignedInteger64 |
getAccessedTime()
Get the last accessed time.
|
UnsignedInteger64 |
getCreateTime()
Get the file create time.
|
byte[] |
getExtendedAttribute(String attrName) |
Map<String,byte[]> |
getExtendedAttributes()
Get the extended attributes.
|
UnsignedInteger32 |
getGID()
Get the GID of this file.
|
String |
getGroup() |
String |
getMaskString()
Return the UNIX style mode mask
|
int |
getModeType() |
UnsignedInteger64 |
getModifiedTime()
Get the last modified time.
|
UnsignedInteger32 |
getPermissions()
Get the current permissions value.
|
String |
getPermissionsString()
Returns a formatted permissions string.
|
UnsignedInteger64 |
getSize()
Get the size of the file.
|
UnsignedInteger32 |
getUID()
Get the UID of the owner.
|
String |
getUsername() |
boolean |
hasAccessedTime()
Get if the file has a last accessed time.
|
boolean |
hasCreateTime()
Get if the file has a create time.
|
boolean |
hasExtendedAttribute(String attrName) |
boolean |
hasGID() |
boolean |
hasGroup()
Get if this file has a group associated with it.
|
boolean |
hasModifiedTime()
Get if the file has a last modified time.
|
boolean |
hasPermissions() |
boolean |
hasSize() |
boolean |
hasUID() |
boolean |
hasUsername()
Get if this file has a username associated with it.
|
boolean |
isBlock()
Determine whether these attributes refer to a block special file.
|
boolean |
isCharacter()
Determine whether these attributes refer to a character device.
|
boolean |
isDirectory()
Determine whether these attributes refer to a directory
|
boolean |
isFifo()
Determine whether these attributes refer to a pipe.
|
boolean |
isFile()
Determine whether these attributes refer to a file.
|
boolean |
isFlagSet(long flag)
Determine if a permissions flag is set.
|
boolean |
isLink()
Determine whether these attributes refer to a symbolic link.
|
boolean |
isSocket()
Determine whether these attributes refer to a socket.
|
void |
removeExtendedAttribute(String attrName)
Set a single extended attribute value.
|
void |
setExtendedAttribute(String attrName,
byte[] attrValue)
Set a single extended attribute value.
|
void |
setExtendedAttributes(Map<String,byte[]> attributes)
Set all the extended attributes.
|
void |
setGID(UnsignedInteger32 gid)
Set the GID of this file.
|
void |
setGID(UnsignedInteger32 gid,
String group) |
void |
setPermissions(String newPermissions)
Set the permissions from a string in the format "rwxr-xr-x"
|
void |
setPermissions(UnsignedInteger32 permissions)
Set the permissions of the file.
|
void |
setPermissionsFromMaskString(String mask)
Set permissions given a UNIX style mask, for example '0644'
|
void |
setPermissionsFromUmaskString(String umask)
Set the permissions given a UNIX style umask, for example '0022' will
result in 0022 ^ 0777.
|
void |
setSize(UnsignedInteger64 size)
Set the size of the file.
|
void |
setTimes(UnsignedInteger64 atime,
UnsignedInteger64 mtime)
Set the last access and last modified times.
|
void |
setTimes(UnsignedInteger64 atime,
UnsignedInteger64 mtime,
UnsignedInteger64 ctime)
Set the last access, last modified and create times.
|
void |
setType(int type) |
void |
setUID(UnsignedInteger32 uid)
Set the UID of the owner.
|
void |
setUID(UnsignedInteger32 uid,
String username) |
byte[] |
toByteArray(int version)
Returns a formatted byte array suitable for encoding into SFTP subsystem
messages.
|
public static final int SSH_FILEXFER_TYPE_REGULAR
public static final int SSH_FILEXFER_TYPE_DIRECTORY
public static final int SSH_FILEXFER_TYPE_SYMLINK
public static final int SSH_FILEXFER_TYPE_SPECIAL
public static final int SSH_FILEXFER_TYPE_UNKNOWN
public static final int SSH_FILEXFER_TYPE_SOCKET
public static final int SSH_FILEXFER_TYPE_CHAR_DEVICE
public static final int SSH_FILEXFER_TYPE_BLOCK_DEVICE
public static final int SSH_FILEXFER_TYPE_FIFO
public static final int S_IFMT
public static final int S_MODE_MASK
public static final int S_IFSOCK
public static final int S_IFLNK
public static final int S_IFREG
public static final int S_IFBLK
public static final int S_IFDIR
public static final int S_IFCHR
public static final int S_IFIFO
public static final int S_ISUID
public static final int S_ISGID
public static final int S_IRUSR
public static final int S_IWUSR
public static final int S_IXUSR
public static final int S_IRGRP
public static final int S_IWGRP
public static final int S_IXGRP
public static final int S_IROTH
public static final int S_IWOTH
public static final int S_IXOTH
public SftpFileAttributes(String charset)
public SftpFileAttributes(int version, String charset, ByteArrayReader bar) throws IOException
IOException
public void setExtendedAttributes(Map<String,byte[]> attributes)
attributes
- map of all extended attributespublic void setExtendedAttribute(String attrName, byte[] attrValue)
attrName
- attribute nameattrValue
- attribute valuepublic void removeExtendedAttribute(String attrName)
attrName
- attribute name to removepublic Map<String,byte[]> getExtendedAttributes()
public boolean hasExtendedAttribute(String attrName)
public byte[] getExtendedAttribute(String attrName)
public UnsignedInteger32 getUID()
public boolean hasUsername()
public boolean hasUID()
public boolean hasGID()
public boolean hasGroup()
public void setUID(UnsignedInteger32 uid)
uid
- public void setUID(UnsignedInteger32 uid, String username)
public String getUsername()
public void setGID(UnsignedInteger32 gid)
gid
- public void setGID(UnsignedInteger32 gid, String group)
public String getGroup()
public UnsignedInteger32 getGID()
public void setSize(UnsignedInteger64 size)
size
- public UnsignedInteger64 getSize()
public boolean hasSize()
public void setPermissions(UnsignedInteger32 permissions)
public void setPermissionsFromMaskString(String mask)
mask
- maskIllegalArgumentException
- if badly formatted stringpublic void setPermissionsFromUmaskString(String umask)
umask
- public void setPermissions(String newPermissions)
newPermissions
- public UnsignedInteger32 getPermissions()
public void setTimes(UnsignedInteger64 atime, UnsignedInteger64 mtime)
atime
- mtime
- public void setTimes(UnsignedInteger64 atime, UnsignedInteger64 mtime, UnsignedInteger64 ctime)
atime
- mtime
- ctime
- public UnsignedInteger64 getAccessedTime()
public boolean hasAccessedTime()
getAccessedTime()
public UnsignedInteger64 getModifiedTime()
public boolean hasModifiedTime()
getModifiedTime()
public UnsignedInteger64 getCreateTime()
public boolean hasCreateTime()
getModifiedTime()
public boolean isFlagSet(long flag)
flag
- public byte[] toByteArray(int version) throws IOException
IOException
public int getModeType()
public String getPermissionsString()
public String getMaskString()
public boolean isDirectory()
public boolean isFile()
public boolean isLink()
public boolean isFifo()
public boolean isBlock()
public boolean isCharacter()
public boolean isSocket()
public void setType(int type)
public boolean hasPermissions()
Copyright © 2024. All rights reserved.