public class CleanFilter extends FilterCommand
Modifier and Type | Field and Description |
---|---|
private AtomicObjectOutputStream |
aOut |
static FilterCommandFactory |
FACTORY
The factory is responsible for creating instances of
CleanFilter |
private Lfs |
lfsUtil |
private long |
size |
private java.nio.file.Path |
tmpFile |
in, out
Constructor and Description |
---|
CleanFilter(Repository db,
java.io.InputStream in,
java.io.OutputStream out)
Constructor for CleanFilter.
|
Modifier and Type | Method and Description |
---|---|
(package private) static void |
register()
Registers this filter by calling
FilterCommandRegistry.register(String, FilterCommandFactory) |
int |
run()
Execute the command.
|
public static final FilterCommandFactory FACTORY
CleanFilter
private AtomicObjectOutputStream aOut
private Lfs lfsUtil
private long size
private java.nio.file.Path tmpFile
public CleanFilter(Repository db, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
db
- the repositoryin
- an InputStream
providing the original contentout
- the OutputStream
into which the content of the
pointer file should be written. That's the content which will
be added to the git repositoryjava.io.IOException
- when the creation of the temporary file fails or when no
OutputStream
for this file can be createdstatic void register()
FilterCommandRegistry.register(String, FilterCommandFactory)
public int run() throws java.io.IOException
FilterCommand.in
and to write the result to FilterCommand.out
. It returns the
number of bytes it read from FilterCommand.in
. It should be called in a loop
until it returns -1 signaling that the InputStream
is
completely processed.
On successful completion (return -1) or on Exception, the streams
FilterCommand.in
and FilterCommand.out
are closed by the implementation.
run
in class FilterCommand
InputStream
or
-1. -1 means that the InputStream
is completely
processed.java.io.IOException
- when IOException
occurred while reading from
FilterCommand.in
or writing to FilterCommand.out