Package org.eclipse.jgit.attributes
Class FilterCommand
java.lang.Object
org.eclipse.jgit.attributes.FilterCommand
- Direct Known Subclasses:
CleanFilter,SmudgeFilter
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 by
FilterCommandFactory.- Since:
- 4.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InputStreamTheInputStreamthis command should read fromprotected OutputStreamTheOutputStreamthis command should write to -
Constructor Summary
ConstructorsConstructorDescriptionFilterCommand(InputStream in, OutputStream out) Constructor for FilterCommand -
Method Summary
-
Field Details
-
in
TheInputStreamthis command should read from -
out
TheOutputStreamthis command should write to
-
-
Constructor Details
-
FilterCommand
Constructor for FilterCommandFilterCommand implementors are required to manage the in and out streams (close on success and/or exception).
- Parameters:
in- TheInputStreamthis command should read fromout- TheOutputStreamthis command should write to
-
-
Method Details
-
run
Execute the command. The command is supposed to read data frominand 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 theInputStreamis completely processed.On successful completion (return -1) or on Exception, the streams
inandoutare closed by the implementation.- Returns:
- the number of bytes read from the
InputStreamor -1. -1 means that theInputStreamis completely processed. - Throws:
IOException- whenIOExceptionoccurred while reading frominor writing toout
-