|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.jgit.dircache.DirCacheEntry
public class DirCacheEntry
A single file (or stage of a file) in a DirCache.
An entry represents exactly one stage of a file. If a file path is unmerged then multiple DirCacheEntry instances may appear for the same path name.
| Field Summary | |
|---|---|
static int |
STAGE_0
The standard (fully merged) stage for an entry. |
static int |
STAGE_1
The base tree revision for an entry. |
static int |
STAGE_2
The first tree revision (usually called "ours"). |
static int |
STAGE_3
The second tree revision (usually called "theirs"). |
| Constructor Summary | |
|---|---|
DirCacheEntry(byte[] newPath)
Create an empty entry at stage 0. |
|
DirCacheEntry(byte[] newPath,
int stage)
Create an empty entry at the specified stage. |
|
DirCacheEntry(java.lang.String newPath)
Create an empty entry at stage 0. |
|
DirCacheEntry(java.lang.String newPath,
int stage)
Create an empty entry at the specified stage. |
|
| Method Summary | |
|---|---|
void |
copyMetaData(DirCacheEntry src)
Copy the ObjectId and other meta fields from an existing entry. |
FileMode |
getFileMode()
Obtain the FileMode for this entry. |
long |
getLastModified()
Get the cached last modification date of this file, in milliseconds. |
int |
getLength()
Get the cached size (in bytes) of this file. |
ObjectId |
getObjectId()
Obtain the ObjectId for the entry. |
java.lang.String |
getPathString()
Get the entry's complete path. |
int |
getRawMode()
Obtain the raw FileMode bits for this entry. |
int |
getStage()
Get the stage of this entry. |
boolean |
isAssumeValid()
Is this entry always thought to be unmodified? |
void |
setAssumeValid(boolean assume)
Set the assume valid flag for this entry, |
void |
setFileMode(FileMode mode)
Set the file mode for this entry. |
void |
setLastModified(long when)
Set the cached last modification date of this file, using milliseconds. |
void |
setLength(int sz)
Set the cached size (in bytes) of this file. |
void |
setObjectId(AnyObjectId id)
Set the ObjectId for the entry. |
void |
setObjectIdFromRaw(byte[] bs,
int p)
Set the ObjectId for the entry from the raw binary representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STAGE_0
public static final int STAGE_1
public static final int STAGE_2
public static final int STAGE_3
| Constructor Detail |
|---|
public DirCacheEntry(java.lang.String newPath)
newPath - name of the cache entry.
public DirCacheEntry(java.lang.String newPath,
int stage)
newPath - name of the cache entry.stage - the stage index of the new entry.public DirCacheEntry(byte[] newPath)
newPath - name of the cache entry, in the standard encoding.
public DirCacheEntry(byte[] newPath,
int stage)
newPath - name of the cache entry, in the standard encoding.stage - the stage index of the new entry.| Method Detail |
|---|
public boolean isAssumeValid()
Most entries in the index do not have this flag set. Users may however set them on if the file system stat() costs are too high on this working directory, such as on NFS or SMB volumes.
public void setAssumeValid(boolean assume)
assume - true to ignore apparent modifications; false to look at last
modified to detect file modifications.public int getStage()
Entries have one of 4 possible stages: 0-3.
public int getRawMode()
FileMode bits for this entry.
FileMode.fromBits(int)public FileMode getFileMode()
FileMode for this entry.
public void setFileMode(FileMode mode)
mode - the new mode constant.public long getLastModified()
One of the indicators that the file has been modified by an application changing the working tree is if the last modification time for the file differs from the time stored in this entry.
public void setLastModified(long when)
when - new cached modification date of the file, in milliseconds.public int getLength()
One of the indicators that the file has been modified by an application changing the working tree is if the size of the file (in bytes) differs from the size stored in this entry.
Note that this is the length of the file in the working directory, which may differ from the size of the decompressed blob if work tree filters are being used, such as LF<->CRLF conversion.
public void setLength(int sz)
sz - new cached size of the file, as bytes.public ObjectId getObjectId()
Using this method to compare ObjectId values between entries is inefficient as it causes memory allocation.
public void setObjectId(AnyObjectId id)
id - new object identifier for the entry. May be
ObjectId.zeroId() to remove the current identifier.
public void setObjectIdFromRaw(byte[] bs,
int p)
bs - the raw byte buffer to read from. At least 20 bytes after p
must be available within this byte array.p - position to read the first byte of data from.public java.lang.String getPathString()
This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function.
public void copyMetaData(DirCacheEntry src)
This method copies everything except the path from one entry to another, supporting renaming.
src - the entry to copy ObjectId and meta fields from.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||