java.lang.Object
org.eclipse.jgit.internal.diffmergetool.FileElement
The element used as left or right file for compare.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFileElement
(String path, FileElement.Type type) Creates file element for path.FileElement
(String path, FileElement.Type type, File workDir) Creates file element for path.FileElement
(String path, FileElement.Type type, File workDir, InputStream stream) Create file element -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add variable to environment map.void
Delete and invalidate temporary file if necessary.createTempFile
(File directory) Create temporary file in given or system temporary directory.getFile()
Get filegetPath()
Get pathgetType()
Get typeboolean
Check if path id "/dev/null"replaceVariable
(String input) Replace variable in input.
-
Constructor Details
-
FileElement
Creates file element for path.- Parameters:
path
- the file pathtype
- the element type
-
FileElement
Creates file element for path.- Parameters:
path
- the file pathtype
- the element typeworkDir
- the working directory of the path (can be null, then current working dir is used)
-
FileElement
Create file element- Parameters:
path
- the file pathtype
- the element typeworkDir
- the working directory of the path (can be null, then current working dir is used)stream
- the object stream to load and write on demand, @see getFile(), to tempFile once (can be null)
-
-
Method Details
-
getPath
Get path- Returns:
- the file path
-
getType
Get type- Returns:
- the element type
-
getFile
Get fileReturn
- a temporary file if already created and stream is not valid
- OR a real file from work tree: if no temp file was created (@see createTempFile()) and if no stream was set
- OR an empty temporary file if path is "/dev/null"
- OR a temporary file with stream content if stream is valid (not null); stream is closed and invalidated (set to null) after write to temp file, so stream is used only once during first call!
- Returns:
- the object stream
- Throws:
IOException
- if an IO error occurred
-
isNullPath
public boolean isNullPath()Check if path id "/dev/null"- Returns:
- true if path is "/dev/null"
-
createTempFile
Create temporary file in given or system temporary directory.- Parameters:
directory
- the directory for the file (can be null); if null system temporary directory is used- Returns:
- temporary file in directory or in the system temporary directory
- Throws:
IOException
- if an IO error occurred
-
cleanTemporaries
public void cleanTemporaries()Delete and invalidate temporary file if necessary. -
replaceVariable
Replace variable in input.- Parameters:
input
- the input string- Returns:
- the replaced input string
- Throws:
IOException
- if an IO error occurred
-
addToEnv
Add variable to environment map.- Parameters:
env
- the environment where this element should be added- Throws:
IOException
- if an IO error occurred
-