Package org.eclipse.jgit.lib
Class FileMode
- java.lang.Object
-
- org.eclipse.jgit.lib.FileMode
-
public abstract class FileMode extends Object
Constants describing various file modes recognized by GIT.GIT uses a subset of the available UNIX file permission bits. The
FileMode
class provides access to constants defining the modes actually used by GIT.
-
-
Field Summary
Fields Modifier and Type Field Description static FileMode
EXECUTABLE_FILE
Mode indicating an entry is an executable file.static FileMode
GITLINK
Mode indicating an entry is a submodule commit in another repository.static FileMode
MISSING
Mode indicating an entry is missing during parallel walks.static FileMode
REGULAR_FILE
Mode indicating an entry is a non-executable file.static FileMode
SYMLINK
Mode indicating an entry is a symbolic link.static FileMode
TREE
Mode indicating an entry is a tree (aka directory).static int
TYPE_FILE
Bit pattern forTYPE_MASK
matchingREGULAR_FILE
.static int
TYPE_GITLINK
static int
TYPE_MASK
Mask to apply to a file mode to obtain its type bits.static int
TYPE_MISSING
static int
TYPE_SYMLINK
static int
TYPE_TREE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
copyTo(byte[] buf, int ptr)
Copy this mode as a sequence of octal US-ASCII bytes.void
copyTo(OutputStream os)
Copy this mode as a sequence of octal US-ASCII bytes.int
copyToLength()
Copy the number of bytes written bycopyTo(OutputStream)
.abstract boolean
equals(int modebits)
Test a file mode for equality with thisFileMode
object.static FileMode
fromBits(int bits)
Convert a set of mode bits into a FileMode enumerated value.int
getBits()
Get the mode bits as an integer.int
getObjectType()
Get the object type that should appear for this type of mode.String
toString()
-
-
-
Field Detail
-
TYPE_MASK
public static final int TYPE_MASK
Mask to apply to a file mode to obtain its type bits.- See Also:
TYPE_TREE
,TYPE_SYMLINK
,TYPE_FILE
,TYPE_GITLINK
,TYPE_MISSING
, Constant Field Values
-
TYPE_TREE
public static final int TYPE_TREE
- See Also:
- Constant Field Values
-
TYPE_SYMLINK
public static final int TYPE_SYMLINK
- See Also:
- Constant Field Values
-
TYPE_FILE
public static final int TYPE_FILE
Bit pattern forTYPE_MASK
matchingREGULAR_FILE
.- See Also:
- Constant Field Values
-
TYPE_GITLINK
public static final int TYPE_GITLINK
- See Also:
- Constant Field Values
-
TYPE_MISSING
public static final int TYPE_MISSING
- See Also:
- Constant Field Values
-
TREE
public static final FileMode TREE
Mode indicating an entry is a tree (aka directory).
-
SYMLINK
public static final FileMode SYMLINK
Mode indicating an entry is a symbolic link.
-
REGULAR_FILE
public static final FileMode REGULAR_FILE
Mode indicating an entry is a non-executable file.
-
EXECUTABLE_FILE
public static final FileMode EXECUTABLE_FILE
Mode indicating an entry is an executable file.
-
GITLINK
public static final FileMode GITLINK
Mode indicating an entry is a submodule commit in another repository.
-
MISSING
public static final FileMode MISSING
Mode indicating an entry is missing during parallel walks.
-
-
Method Detail
-
fromBits
public static final FileMode fromBits(int bits)
Convert a set of mode bits into a FileMode enumerated value.- Parameters:
bits
- the mode bits the caller has somehow obtained.- Returns:
- the FileMode instance that represents the given bits.
-
equals
public abstract boolean equals(int modebits)
Test a file mode for equality with thisFileMode
object.- Parameters:
modebits
- a int.- Returns:
- true if the mode bits represent the same mode as this object
-
copyTo
public void copyTo(OutputStream os) throws IOException
Copy this mode as a sequence of octal US-ASCII bytes.The mode is copied as a sequence of octal digits using the US-ASCII character encoding. The sequence does not use a leading '0' prefix to indicate octal notation. This method is suitable for generation of a mode string within a GIT tree object.
- Parameters:
os
- stream to copy the mode to.- Throws:
IOException
- the stream encountered an error during the copy.
-
copyTo
public void copyTo(byte[] buf, int ptr)
Copy this mode as a sequence of octal US-ASCII bytes. The mode is copied as a sequence of octal digits using the US-ASCII character encoding. The sequence does not use a leading '0' prefix to indicate octal notation. This method is suitable for generation of a mode string within a GIT tree object.- Parameters:
buf
- buffer to copy the mode to.ptr
- position withinbuf
for first digit.
-
copyToLength
public int copyToLength()
Copy the number of bytes written bycopyTo(OutputStream)
.- Returns:
- the number of bytes written by
copyTo(OutputStream)
.
-
getObjectType
public int getObjectType()
Get the object type that should appear for this type of mode.See the object type constants in
Constants
.- Returns:
- one of the well known object type constants.
-
toString
public String toString()
Format this mode as an octal string (for debugging only).
-
getBits
public int getBits()
Get the mode bits as an integer.- Returns:
- The mode bits as an integer.
-
-