Package org.eclipse.jgit.attributes
Class FilterCommand
- java.lang.Object
-
- org.eclipse.jgit.attributes.FilterCommand
-
- Direct Known Subclasses:
CleanFilter
,SmudgeFilter
public abstract class FilterCommand extends Object
An abstraction for JGit's builtin implementations for hooks and filters. Instead of spawning an external processes to start a filter/hook and to pump data from/to stdin/stdout these builtin commmands may be used. They are constructed byFilterCommandFactory
.- Since:
- 4.6
-
-
Field Summary
Fields Modifier and Type Field Description protected InputStream
in
TheInputStream
this command should read fromprotected OutputStream
out
TheOutputStream
this command should write to
-
Constructor Summary
Constructors Constructor Description FilterCommand(InputStream in, OutputStream out)
Constructor for FilterCommand
-
-
-
Field Detail
-
in
protected InputStream in
TheInputStream
this command should read from
-
out
protected OutputStream out
TheOutputStream
this command should write to
-
-
Constructor Detail
-
FilterCommand
public FilterCommand(InputStream in, OutputStream out)
Constructor for FilterCommandFilterCommand implementors are required to manage the in and out streams (close on success and/or exception).
- Parameters:
in
- TheInputStream
this command should read fromout
- TheOutputStream
this command should write to
-
-
Method Detail
-
run
public abstract int run() throws IOException
Execute the command. The command is supposed to read data fromin
and to write the result toout
. It returns the number of bytes it read fromin
. 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
in
andout
are closed by the implementation.- Returns:
- the number of bytes read from the
InputStream
or -1. -1 means that theInputStream
is completely processed. - Throws:
IOException
- whenIOException
occurred while reading fromin
or writing toout
-
-