Class Lfs


  • public class Lfs
    extends java.lang.Object
    Class which represents the lfs folder hierarchy inside a .git folder
    Since:
    4.6
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.file.Path objDir  
      private java.nio.file.Path root  
      private java.nio.file.Path tmpDir  
    • Constructor Summary

      Constructors 
      Constructor Description
      Lfs​(Repository db)
      Constructor for Lfs.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.file.Path createTmpFile()
      Create a new temp file in the LFS directory
      java.nio.file.Path getLfsObjDir()
      Get the object directory used by LFS
      java.nio.file.Path getLfsRoot()
      Get the LFS root directory
      java.nio.file.Path getLfsTmpDir()
      Get the path to the temporary directory used by LFS.
      java.nio.file.Path getMediaFile​(AnyLongObjectId id)
      Get the media file which stores the original content
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • root

        private java.nio.file.Path root
      • objDir

        private java.nio.file.Path objDir
      • tmpDir

        private java.nio.file.Path tmpDir
    • Constructor Detail

      • Lfs

        public Lfs​(Repository db)
        Constructor for Lfs.
        Parameters:
        db - the associated repo
        Since:
        4.11
    • Method Detail

      • getLfsRoot

        public java.nio.file.Path getLfsRoot()
        Get the LFS root directory
        Returns:
        the path to the LFS directory
      • getLfsTmpDir

        public java.nio.file.Path getLfsTmpDir()
        Get the path to the temporary directory used by LFS.
        Returns:
        the path to the temporary directory used by LFS. Will be <repo>/.git/lfs/tmp
      • getLfsObjDir

        public java.nio.file.Path getLfsObjDir()
        Get the object directory used by LFS
        Returns:
        the path to the object directory used by LFS. Will be <repo>/.git/lfs/objects
      • getMediaFile

        public java.nio.file.Path getMediaFile​(AnyLongObjectId id)
        Get the media file which stores the original content
        Parameters:
        id - the id of the mediafile
        Returns:
        the file which stores the original content. Its path will look like "<repo>/.git/lfs/objects/<firstTwoLettersOfID>/<remainingLettersOfID>"
      • createTmpFile

        public java.nio.file.Path createTmpFile()
                                         throws java.io.IOException
        Create a new temp file in the LFS directory
        Returns:
        a new temporary file in the LFS directory
        Throws:
        java.io.IOException - when the temp file could not be created