Top Description Fields Constructors Methods
org.eclipse.jgit.lib

public abstract Class FileMode

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream

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

Modifier and TypeField and Description
public static final FileMode
EXECUTABLE_FILE

Mode indicating an entry is an executable file.

public static final FileMode
GITLINK

Mode indicating an entry is a submodule commit in another repository.

public static final FileMode
MISSING

Mode indicating an entry is missing during parallel walks.

private final int
private final int
private final byte[]
public static final FileMode
REGULAR_FILE

Mode indicating an entry is a non-executable file.

public static final FileMode
SYMLINK

Mode indicating an entry is a symbolic link.

public static final FileMode
TREE

Mode indicating an entry is a tree (aka directory).

public static final int
TYPE_FILE

Bit pattern for TYPE_MASK matching REGULAR_FILE.

public static final int
TYPE_GITLINK

Bit pattern for TYPE_MASK matching GITLINK.

public static final int
TYPE_MASK

Mask to apply to a file mode to obtain its type bits.

public static final int
TYPE_MISSING

Bit pattern for TYPE_MASK matching MISSING.

public static final int
TYPE_SYMLINK

Bit pattern for TYPE_MASK matching SYMLINK.

public static final int
TYPE_TREE

Bit pattern for TYPE_MASK matching TREE.

Constructor Summary

AccessConstructor and Description
private
FileMode(int mode, int expType)

Method Summary

Modifier and TypeMethod and Description
public void
copyTo(OutputStream
stream to copy the mode to.
os
)

Copy this mode as a sequence of octal US-ASCII bytes.

public void
copyTo(byte[]
buffer to copy the mode to.
buf
,
int
position within buf for first digit.
ptr
)

Copy this mode as a sequence of octal US-ASCII bytes.

public int

Returns:

the number of bytes written by copyTo(OutputStream).
copyToLength
()

Copy the number of bytes written by copyTo(OutputStream).

public abstract boolean

Returns:

true if the mode bits represent the same mode as this object
equals
(int
a int.
modeBits
)

Test a file mode for equality with this org.eclipse.jgit.lib.FileMode object.

public static final FileMode

Returns:

the FileMode instance that represents the given bits.
fromBits
(int
the mode bits the caller has somehow obtained.
bits
)

Convert a set of mode bits into a FileMode enumerated value.

public int

Returns:

The mode bits as an integer.
getBits
()

Get the mode bits as an integer.

public int

Returns:

one of the well known object type constants.
getObjectType
()

Get the object type that should appear for this type of mode.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

EXECUTABLE_FILEback to summary
public static final FileMode EXECUTABLE_FILE

Mode indicating an entry is an executable file.

MISSINGback to summary
public static final FileMode MISSING

Mode indicating an entry is missing during parallel walks.

modeBitsback to summary
private final int modeBits
objectTypeback to summary
private final int objectType
octalBytesback to summary
private final byte[] octalBytes
REGULAR_FILEback to summary
public static final FileMode REGULAR_FILE

Mode indicating an entry is a non-executable file.

TREEback to summary
public static final FileMode TREE

Mode indicating an entry is a tree (aka directory).

TYPE_FILEback to summary
public static final int TYPE_FILE

Bit pattern for TYPE_MASK matching REGULAR_FILE.

TYPE_MASKback to summary
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
TYPE_MISSINGback to summary
public static final int TYPE_MISSING

Bit pattern for TYPE_MASK matching MISSING.

TYPE_TREEback to summary
public static final int TYPE_TREE

Bit pattern for TYPE_MASK matching TREE.

Constructor Detail

FileModeback to summary
private FileMode(int mode, int expType)

Method Detail

copyToback to summary
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:OutputStream

stream to copy the mode to.

Exceptions
IOException:
the stream encountered an error during the copy.
copyToback to summary
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:byte[]

buffer to copy the mode to.

ptr:int

position within buf for first digit.

copyToLengthback to summary
public int copyToLength()

Copy the number of bytes written by copyTo(OutputStream).

Returns:int

the number of bytes written by copyTo(OutputStream).

equalsback to summary
public abstract boolean equals(int modeBits)

Test a file mode for equality with this org.eclipse.jgit.lib.FileMode object.

Parameters
modeBits:int

a int.

Returns:boolean

true if the mode bits represent the same mode as this object

Annotations
@SuppressWarnings:NonOverridingEquals
fromBitsback to summary
public static final FileMode fromBits(int bits)

Convert a set of mode bits into a FileMode enumerated value.

Parameters
bits:int

the mode bits the caller has somehow obtained.

Returns:FileMode

the FileMode instance that represents the given bits.

getBitsback to summary
public int getBits()

Get the mode bits as an integer.

Returns:int

The mode bits as an integer.

getObjectTypeback to summary
public int getObjectType()

Get the object type that should appear for this type of mode.

See the object type constants in org.eclipse.jgit.lib.Constants.

Returns:int

one of the well known object type constants.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Format this mode as an octal string (for debugging only).

Returns:String

a string representation of the object

Annotations
@Override