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) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd variable to environment map.voidDelete and invalidate temporary file if necessary.createTempFile(File directory) Create temporary file in given or system temporary directory.getFile()Return 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!getPath()getType()booleanCheck 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
- 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
- Returns:
- the file path
-
getType
- Returns:
- the element type
-
getFile
Return- 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
-
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
-
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
-
addToEnv
Add variable to environment map.- Parameters:
env- the environment where this element should be added- Throws:
IOException
-