KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > ssh2 > sftp > AttribBits


1
2 package ch.ethz.ssh2.sftp;
3
4 /**
5  *
6  * SFTP Attribute Bits for the "attrib-bits" and "attrib-bits-valid" fields
7  * of the SFTP ATTR data type.
8  * <p>
9  * Yes, these are the "attrib-bits", even though they have "_FLAGS_" in
10  * their name. Don't ask - I did not invent it.
11  * <p>
12  * "<i>These fields, taken together, reflect various attributes of the file
13  * or directory, on the server. Bits not set in 'attrib-bits-valid' MUST be
14  * ignored in the 'attrib-bits' field. This allows both the server and the
15  * client to communicate only the bits it knows about without inadvertently
16  * twiddling bits they don't understand.</i>"
17  *
18  * @author Christian Plattner, plattner@inf.ethz.ch
19  * @version $Id: AttribBits.java,v 1.2 2006/08/02 12:05:00 cplattne Exp $
20  *
21  */

22 public class AttribBits
23 {
24     /**
25      * Advisory, read-only bit. This bit is not part of the access
26      * control information on the file, but is rather an advisory field
27      * indicating that the file should not be written.
28      */

29     public static final int SSH_FILEXFER_ATTR_FLAGS_READONLY = 0x00000001;
30
31     /**
32      * The file is part of the operating system.
33      */

34     public static final int SSH_FILEXFER_ATTR_FLAGS_SYSTEM = 0x00000002;
35
36     /**
37      * File SHOULD NOT be shown to user unless specifically requested.
38      * For example, most UNIX systems SHOULD set this bit if the filename
39      * begins with a 'period'. This bit may be read-only (see section 5.4 of
40      * the SFTP standard draft). Most UNIX systems will not allow this to be
41      * changed.
42      */

43     public static final int SSH_FILEXFER_ATTR_FLAGS_HIDDEN = 0x00000004;
44
45     /**
46      * This attribute applies only to directories. This attribute is
47      * always read-only, and cannot be modified. This attribute means
48      * that files and directory names in this directory should be compared
49      * without regard to case.
50      * <p>
51      * It is recommended that where possible, the server's filesystem be
52      * allowed to do comparisons. For example, if a client wished to prompt
53      * a user before overwriting a file, it should not compare the new name
54      * with the previously retrieved list of names in the directory. Rather,
55      * it should first try to create the new file by specifying
56      * SSH_FXF_CREATE_NEW flag. Then, if this fails and returns
57      * SSH_FX_FILE_ALREADY_EXISTS, it should prompt the user and then retry
58      * the create specifying SSH_FXF_CREATE_TRUNCATE.
59      * <p>
60      * Unless otherwise specified, filenames are assumed to be case sensitive.
61      */

62     public static final int SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE = 0x00000008;
63
64     /**
65      * The file should be included in backup / archive operations.
66      */

67     public static final int SSH_FILEXFER_ATTR_FLAGS_ARCHIVE = 0x00000010;
68
69     /**
70      * The file is stored on disk using file-system level transparent
71      * encryption. This flag does not affect the file data on the wire
72      * (for either READ or WRITE requests.)
73      */

74     public static final int SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED = 0x00000020;
75
76     /**
77      * The file is stored on disk using file-system level transparent
78      * compression. This flag does not affect the file data on the wire.
79      */

80     public static final int SSH_FILEXFER_ATTR_FLAGS_COMPRESSED = 0x00000040;
81
82     /**
83      * The file is a sparse file; this means that file blocks that have
84      * not been explicitly written are not stored on disk. For example, if
85      * a client writes a buffer at 10 M from the beginning of the file,
86      * the blocks between the previous EOF marker and the 10 M offset would
87      * not consume physical disk space.
88      * <p>
89      * Some servers may store all files as sparse files, in which case
90      * this bit will be unconditionally set. Other servers may not have
91      * a mechanism for determining if the file is sparse, and so the file
92      * MAY be stored sparse even if this flag is not set.
93      */

94     public static final int SSH_FILEXFER_ATTR_FLAGS_SPARSE = 0x00000080;
95
96     /**
97      * Opening the file without either the SSH_FXF_ACCESS_APPEND_DATA or
98      * the SSH_FXF_ACCESS_APPEND_DATA_ATOMIC flag (see section 8.1.1.3
99      * of the SFTP standard draft) MUST result in an
100      * SSH_FX_INVALID_PARAMETER error.
101      */

102     public static final int SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY = 0x00000100;
103
104     /**
105      * The file cannot be deleted or renamed, no hard link can be created
106      * to this file, and no data can be written to the file.
107      * <p>
108      * This bit implies a stronger level of protection than
109      * SSH_FILEXFER_ATTR_FLAGS_READONLY, the file permission mask or ACLs.
110      * Typically even the superuser cannot write to immutable files, and
111      * only the superuser can set or remove the bit.
112      */

113     public static final int SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE = 0x00000200;
114
115     /**
116      * When the file is modified, the changes are written synchronously
117      * to the disk.
118      */

119     public static final int SSH_FILEXFER_ATTR_FLAGS_SYNC = 0x00000400;
120
121     /**
122      * The server MAY include this bit in a directory listing or realpath
123      * response. It indicates there was a failure in the translation to UTF-8.
124      * If this flag is included, the server SHOULD also include the
125      * UNTRANSLATED_NAME attribute.
126      */

127     public static final int SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR = 0x00000800;
128
129 }
130
Popular Tags