Class LfsBlobFilter


  • public class LfsBlobFilter
    extends Object
    Provides transparently either a stream to the blob or a LFS media file if managed by LFS.
    Since:
    4.11
    • Constructor Detail

      • LfsBlobFilter

        public LfsBlobFilter()
    • Method Detail

      • smudgeLfsBlob

        public static ObjectLoader smudgeLfsBlob​(Repository db,
                                                 ObjectLoader loader)
                                          throws IOException
        In case the given ObjectLoader points to a LFS pointer file replace the loader with one pointing to the LFS media file contents. Missing LFS files are downloaded on the fly - same logic as the smudge filter.
        Parameters:
        db - the repo
        loader - the loader for the blob
        Returns:
        either the original loader, or a loader for the LFS media file if managed by LFS. Files are downloaded on demand if required.
        Throws:
        IOException - in case of an error
      • cleanLfsBlob

        public static TemporaryBuffer cleanLfsBlob​(Repository db,
                                                   InputStream originalContent)
                                            throws IOException
        Run the LFS clean filter on the given stream and return a stream to the LFS pointer file buffer. Used when inserting objects.
        Parameters:
        db - the Repository
        originalContent - the InputStream to the original content
        Returns:
        a TemporaryBuffer representing the LFS pointer. The caller is responsible to destroy the buffer.
        Throws:
        IOException - in case of any error.