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 |
SFX_ACL_AUDIT_ALARM_INCLUDED |
static int |
SFX_ACL_AUDIT_ALARM_INHERITED |
static int |
SFX_ACL_CONTROL_INCLUDED |
static int |
SFX_ACL_CONTROL_INHERITED |
static int |
SFX_ACL_CONTROL_PRESENT |
static int |
SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY |
static int |
SSH_FILEXFER_ATTR_FLAGS_ARCHIVE |
static int |
SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE |
static int |
SSH_FILEXFER_ATTR_FLAGS_COMPRESSED |
static int |
SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED |
static int |
SSH_FILEXFER_ATTR_FLAGS_HIDDEN |
static int |
SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE |
static int |
SSH_FILEXFER_ATTR_FLAGS_READONLY |
static int |
SSH_FILEXFER_ATTR_FLAGS_SPARSE |
static int |
SSH_FILEXFER_ATTR_FLAGS_SYNC |
static int |
SSH_FILEXFER_ATTR_FLAGS_SYSTEM |
static int |
SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR |
static int |
SSH_FILEXFER_ATTR_GUESSED_BINARY |
static int |
SSH_FILEXFER_ATTR_GUESSED_TEXT |
static int |
SSH_FILEXFER_ATTR_KNOWN_BINARY |
static int |
SSH_FILEXFER_ATTR_KNOWN_TEXT |
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(ByteArrayReader bar,
int version,
Long supportedAttributeBits,
Long supportedAttributeMask,
String charsetEncoding) |
SftpFileAttributes(SftpSubsystemChannel sftp,
ByteArrayReader bar) |
SftpFileAttributes(SftpSubsystemChannel sftp,
int type)
Creates a new FileAttributes object.
|
Modifier and Type | Method and Description |
---|---|
Date |
getAccessedDateTime()
Returns the last accessed date/time as a Java Date object.
|
UnsignedInteger64 |
getAccessedTime()
Get the last accessed time.
|
Date |
getCreationDateTime()
Returns the creation date/time as a Java Date object.
|
UnsignedInteger64 |
getCreationTime()
Get the creation time of this file.
|
byte[] |
getExtendedAttribute(String attrName) |
Map<String,byte[]> |
getExtendedAttributes()
Get the extended attributes.
|
String |
getGID()
Get the GID of this file.
|
String |
getMaskString()
Return the UNIX style mode mask
|
Date |
getModifiedDateTime()
Returns the modified date/time as a Java Date object.
|
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.
|
int |
getType() |
String |
getUID()
Get the UID of the owner.
|
boolean |
hasAttributeBits() |
boolean |
hasExtendedAttribute(String attrName) |
boolean |
hasGID() |
boolean |
hasSize() |
boolean |
hasUID() |
boolean |
isAppendOnly() |
boolean |
isArchive() |
boolean |
isAttributeBitSet(long attributeBit) |
boolean |
isBlock()
Determine whether these attributes refer to a block special file.
|
boolean |
isCaseInsensitive() |
boolean |
isCharacter()
Determine whether these attributes refer to a character device.
|
boolean |
isCompressed() |
boolean |
isDirectory()
Determine whether these attributes refer to a directory
|
boolean |
isEncrypted() |
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 |
isHidden() |
boolean |
isImmutable() |
boolean |
isLink()
Determine whether these attributes refer to a symbolic link.
|
boolean |
isReadOnly() |
boolean |
isSocket()
Determine whether these attributes refer to a socket.
|
boolean |
isSparse() |
boolean |
isSync() |
boolean |
isSystem() |
void |
removeExtendedAttribute(String attrName)
Set a single extended attribute value.
|
void |
setAppendOnly(boolean value) |
void |
setArchive(boolean value) |
void |
setCaseSensitive(boolean value) |
void |
setCompressed(boolean value) |
void |
setEncrypted(boolean 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(String gid)
Set the GID of this file.
|
void |
setHidden(boolean value) |
void |
setImmutable(boolean value) |
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 |
setReadOnly(boolean value) |
void |
setSize(UnsignedInteger64 size)
Set the size of the file.
|
void |
setSparse(boolean value) |
void |
setSync(boolean value) |
void |
setSystem(boolean value) |
void |
setTimes(UnsignedInteger64 atime,
UnsignedInteger64 mtime)
Set the last access and last modified times.
|
void |
setUID(String uid)
Set the UID of the owner.
|
byte[] |
toByteArray()
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 SSH_FILEXFER_ATTR_FLAGS_READONLY
public static final int SSH_FILEXFER_ATTR_FLAGS_SYSTEM
public static final int SSH_FILEXFER_ATTR_FLAGS_HIDDEN
public static final int SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE
public static final int SSH_FILEXFER_ATTR_FLAGS_ARCHIVE
public static final int SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED
public static final int SSH_FILEXFER_ATTR_FLAGS_COMPRESSED
public static final int SSH_FILEXFER_ATTR_FLAGS_SPARSE
public static final int SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY
public static final int SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE
public static final int SSH_FILEXFER_ATTR_FLAGS_SYNC
public static final int SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR
public static final int SFX_ACL_CONTROL_INCLUDED
public static final int SFX_ACL_CONTROL_PRESENT
public static final int SFX_ACL_CONTROL_INHERITED
public static final int SFX_ACL_AUDIT_ALARM_INCLUDED
public static final int SFX_ACL_AUDIT_ALARM_INHERITED
public static final int SSH_FILEXFER_ATTR_KNOWN_TEXT
public static final int SSH_FILEXFER_ATTR_GUESSED_TEXT
public static final int SSH_FILEXFER_ATTR_KNOWN_BINARY
public static final int SSH_FILEXFER_ATTR_GUESSED_BINARY
public static final int S_IFMT
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(SftpSubsystemChannel sftp, int type)
public SftpFileAttributes(SftpSubsystemChannel sftp, ByteArrayReader bar) throws IOException
sftp
- bar
- IOException
public SftpFileAttributes(ByteArrayReader bar, int version, Long supportedAttributeBits, Long supportedAttributeMask, String charsetEncoding) throws IOException
IOException
public int getType()
public String getUID()
public void setUID(String uid)
uid
- public void setGID(String gid)
gid
- public String getGID()
public boolean hasUID()
public boolean hasGID()
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
- IllegalArgumentException
- if badly formatted stringpublic void setPermissions(String newPermissions)
newPermissions
- public UnsignedInteger32 getPermissions()
public void setTimes(UnsignedInteger64 atime, UnsignedInteger64 mtime)
atime
- mtime
- public UnsignedInteger64 getAccessedTime()
public UnsignedInteger64 getModifiedTime()
public Date getModifiedDateTime()
public Date getCreationDateTime()
public Date getAccessedDateTime()
public UnsignedInteger64 getCreationTime()
public boolean isFlagSet(long flag)
flag
- public byte[] toByteArray() throws IOException
IOException
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 boolean hasAttributeBits()
public boolean isAttributeBitSet(long attributeBit) throws SftpStatusException
SftpStatusException
public boolean isReadOnly() throws SftpStatusException
SftpStatusException
public void setReadOnly(boolean value) throws SftpStatusException
SftpStatusException
public boolean isSystem() throws SftpStatusException
SftpStatusException
public void setSystem(boolean value) throws SftpStatusException
SftpStatusException
public boolean isHidden() throws SftpStatusException
SftpStatusException
public void setHidden(boolean value) throws SftpStatusException
SftpStatusException
public boolean isCaseInsensitive() throws SftpStatusException
SftpStatusException
public void setCaseSensitive(boolean value) throws SftpStatusException
SftpStatusException
public boolean isArchive() throws SftpStatusException
SftpStatusException
public void setArchive(boolean value) throws SftpStatusException
SftpStatusException
public boolean isEncrypted() throws SftpStatusException
SftpStatusException
public void setEncrypted(boolean value) throws SftpStatusException
SftpStatusException
public boolean isCompressed() throws SftpStatusException
SftpStatusException
public void setCompressed(boolean value) throws SftpStatusException
SftpStatusException
public boolean isSparse() throws SftpStatusException
SftpStatusException
public void setSparse(boolean value) throws SftpStatusException
SftpStatusException
public boolean isAppendOnly() throws SftpStatusException
SftpStatusException
public void setAppendOnly(boolean value) throws SftpStatusException
SftpStatusException
public boolean isImmutable() throws SftpStatusException
SftpStatusException
public void setImmutable(boolean value) throws SftpStatusException
SftpStatusException
public boolean isSync() throws SftpStatusException
SftpStatusException
public void setSync(boolean value) throws SftpStatusException
SftpStatusException
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)
Copyright © 2024. All rights reserved.