Secure iNet Factory

com.jscape.inet.sftp.packets
Class SftpFileAttributes

java.lang.Object
  extended by com.jscape.inet.sftp.packets.SftpFileAttributes

public class SftpFileAttributes
extends java.lang.Object

The SFTP file attributes.

Author:
Alex Usun

Nested Class Summary
static class SftpFileAttributes.AttributePresenceFlags
          The attribute presence flags.
 
Constructor Summary
SftpFileAttributes()
           
 
Method Summary
static SftpFileAttributes forFile(JFile file)
          Obtains the file attributes for the specified file.
 long getAtime()
          Obtains the file access time.
 byte[] getExtension(java.lang.String type)
          Obtains the file extension data.
 SftpFileAttributes.AttributePresenceFlags getFlags()
           
 int getGid()
          Obtains the file gid.
 long getMtime()
          Obtains the file modification time.
 JFilePermissions getPermissions()
          Obtains the file permissions.
 long getSize()
          Obtains the file size.
 int getUid()
          Obtains the file uid.
static SftpFileAttributes readFrom(java.io.InputStream in, java.lang.String charset)
          Reads the file attributes from the stream.
 void setAtime(long atime)
          Setups the file access time.
 void setExtension(java.lang.String type, byte[] data)
          Setups the file extension attribute.
 void setGid(int gid)
          Setups the file gid.
 void setMtime(long mtime)
          Setups the file modification time.
 void setPermissions(JFilePermissions permissions)
          Setups the file permissions.
 void setSize(long size)
          Setups the file size.
 void setUid(int uid)
          Setups the file uid.
 void setupFileAttributes(JFile file)
          Setups the attributes for the specified file.
 java.lang.String toString()
           
 void writeTo(java.io.OutputStream out, java.lang.String charset)
          Writes the current object to the specified stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SftpFileAttributes

public SftpFileAttributes()
Method Detail

readFrom

public static SftpFileAttributes readFrom(java.io.InputStream in,
                                          java.lang.String charset)
                                   throws java.io.IOException
Reads the file attributes from the stream.

Parameters:
in - the source input stream
Returns:
the readed file attributes
Throws:
java.io.IOException - if an I/O error occurs

forFile

public static SftpFileAttributes forFile(JFile file)
Obtains the file attributes for the specified file.

Parameters:
file - the target file
Returns:
the file attributes

getFlags

public SftpFileAttributes.AttributePresenceFlags getFlags()

setSize

public void setSize(long size)
Setups the file size.

Parameters:
size - the file size

getSize

public long getSize()
Obtains the file size.

Returns:
the file size

setUid

public void setUid(int uid)
Setups the file uid.

Parameters:
uid - the file uid

getUid

public int getUid()
Obtains the file uid.

Returns:
the file uid

setGid

public void setGid(int gid)
Setups the file gid.

Parameters:
gid - the file gid

getGid

public int getGid()
Obtains the file gid.

Returns:
the file gid

setPermissions

public void setPermissions(JFilePermissions permissions)
Setups the file permissions.

Parameters:
permissions - the file permissions

getPermissions

public JFilePermissions getPermissions()
Obtains the file permissions.

Returns:
the file permissions

setAtime

public void setAtime(long atime)
Setups the file access time.

Parameters:
atime - the file access time

getAtime

public long getAtime()
Obtains the file access time.

Returns:
the file access time

setMtime

public void setMtime(long mtime)
Setups the file modification time.

Parameters:
mtime - the file modification time

getMtime

public long getMtime()
Obtains the file modification time.

Returns:
the file modification time

setExtension

public void setExtension(java.lang.String type,
                         byte[] data)
Setups the file extension attribute.

Parameters:
type - the extension attribute name
data - the extension data

getExtension

public byte[] getExtension(java.lang.String type)
Obtains the file extension data.

Parameters:
type - the extension name
Returns:
the extension data

writeTo

public void writeTo(java.io.OutputStream out,
                    java.lang.String charset)
             throws java.io.IOException
Writes the current object to the specified stream.

Parameters:
out - the output stream
Throws:
java.io.IOException - if I/O error occured

setupFileAttributes

public void setupFileAttributes(JFile file)
Setups the attributes for the specified file.

Parameters:
file - the target file

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved