Package org.eclipse.jgit.lfs
Class SmudgeFilter
- java.lang.Object
-
- org.eclipse.jgit.attributes.FilterCommand
-
- org.eclipse.jgit.lfs.SmudgeFilter
-
public class SmudgeFilter extends FilterCommand
Built-in LFS smudge filter When content is read from git's object-database and written to the filesystem and this filter is configured for that content, then this filter will replace the content of LFS pointer files with the original content. This happens e.g. when a checkout needs to update a working tree file which is under LFS control.- Since:
- 4.6
-
-
Field Summary
Fields Modifier and Type Field Description static FilterCommandFactory
FACTORY
The factory is responsible for creating instances ofSmudgeFilter
-
Fields inherited from class org.eclipse.jgit.attributes.FilterCommand
in, out
-
-
Constructor Summary
Constructors Constructor Description SmudgeFilter(Repository db, InputStream in, OutputStream out)
Constructor for SmudgeFilter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Collection<Path>
downloadLfsResource(Lfs lfs, Repository db, LfsPointer... res)
Download content which is hosted on a LFS serverint
run()
Execute the command.
-
-
-
Field Detail
-
FACTORY
public static final FilterCommandFactory FACTORY
The factory is responsible for creating instances ofSmudgeFilter
-
-
Constructor Detail
-
SmudgeFilter
public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException
Constructor for SmudgeFilter.- Parameters:
db
- aRepository
object.in
- aInputStream
object. The stream is closed in any case.out
- aOutputStream
object.- Throws:
IOException
- in case of an error
-
-
Method Detail
-
downloadLfsResource
public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db, LfsPointer... res) throws IOException
Download content which is hosted on a LFS server- Parameters:
lfs
- localLfs
storage.db
- the repository to work withres
- the objects to download- Returns:
- the paths of all mediafiles which have been downloaded
- Throws:
IOException
- Since:
- 4.11
-
run
public int run() throws IOException
Execute the command. The command is supposed to read data fromFilterCommand.in
and to write the result toFilterCommand.out
. It returns the number of bytes it read fromFilterCommand.in
. It should be called in a loop until it returns -1 signaling that theInputStream
is completely processed.On successful completion (return -1) or on Exception, the streams
FilterCommand.in
andFilterCommand.out
are closed by the implementation.- Specified by:
run
in classFilterCommand
- Returns:
- the number of bytes read from the
InputStream
or -1. -1 means that theInputStream
is completely processed. - Throws:
IOException
- whenIOException
occurred while reading fromFilterCommand.in
or writing toFilterCommand.out
-
-