Top Description Fields Constructors Methods
org.eclipse.jgit.lfs

public Class CleanFilter

extends FilterCommand
Class Inheritance
Imports
java.io.IOException, .InputStream, .OutputStream, java.nio.file.Files, .Path, .StandardCopyOption, org.eclipse.jgit.attributes.FilterCommand, .FilterCommandFactory, .FilterCommandRegistry, org.eclipse.jgit.lfs.errors.CorruptMediaFile, org.eclipse.jgit.lfs.internal.AtomicObjectOutputStream, org.eclipse.jgit.lfs.lib.AnyLongObjectId, .Constants, org.eclipse.jgit.lib.Repository, org.eclipse.jgit.util.FileUtils

Built-in LFS clean filter When new content is about to be added to the git repository and this filter is configured for that content, then this filter will replace the original content with content of a so-called LFS pointer file. The pointer file content will then be added to the git repository. Additionally this filter writes the original content in a so-called 'media file' to '.git/lfs/objects/ <first-two-characters-of-contentid>/<rest-of-contentid>'
Since
4.6
See Also
Git LFS Specification

Field Summary

Modifier and TypeField and Description
private AtomicObjectOutputStream
public static final FilterCommandFactory
FACTORY

The factory is responsible for creating instances of org.eclipse.jgit.lfs.CleanFilter

private Lfs
private long
private Path
Inherited from org.eclipse.jgit.attributes.FilterCommand:
inout

Constructor Summary

AccessConstructor and Description
public
CleanFilter(Repository
the repository
db
,
InputStream
an java.io.InputStream providing the original content
in
,
OutputStream
the java.io.OutputStream into which the content of the pointer file should be written. That's the content which will be added to the git repository
out
)

Constructor for CleanFilter.

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
public int
run()

Implements abstract org.eclipse.jgit.attributes.FilterCommand.run.

Execute the command.

Field Detail

aOutback to summary
private AtomicObjectOutputStream aOut
FACTORYback to summary
public static final FilterCommandFactory FACTORY

The factory is responsible for creating instances of org.eclipse.jgit.lfs.CleanFilter

lfsUtilback to summary
private Lfs lfsUtil
sizeback to summary
private long size
tmpFileback to summary
private Path tmpFile

Constructor Detail

CleanFilterback to summary
public CleanFilter(Repository db, InputStream in, OutputStream out) throws IOException

Constructor for CleanFilter.

Parameters
db:Repository

the repository

in:InputStream

an java.io.InputStream providing the original content

out:OutputStream

the java.io.OutputStream into which the content of the pointer file should be written. That's the content which will be added to the git repository

Exceptions
IOException:
when the creation of the temporary file fails or when no java.io.OutputStream for this file can be created

Method Detail

registerback to summary
pack-priv static void register()

Registers this filter by calling FilterCommandRegistry#register(String, FilterCommandFactory)

runback to summary
public int run() throws IOException

Implements abstract org.eclipse.jgit.attributes.FilterCommand.run.

Doc from org.eclipse.jgit.attributes.FilterCommand.run.

Execute the command. The command is supposed to read data from in and to write the result to out. It returns the number of bytes it read from in. It should be called in a loop until it returns -1 signaling that the java.io.InputStream is completely processed.

On successful completion (return -1) or on Exception, the streams in and out are closed by the implementation.

Returns:int

the number of bytes read from the java.io.InputStream or -1. -1 means that the java.io.InputStream is completely processed.

Annotations
@Override
Exceptions
IOException:
when java.io.IOException occurred while reading from in or writing to out