Class FileLfsRepository

  • All Implemented Interfaces:
    LargeFileRepository

    public class FileLfsRepository
    extends java.lang.Object
    implements LargeFileRepository
    Repository storing large objects in the file system
    Since:
    4.3
    • Field Detail

      • url

        private java.lang.String url
      • dir

        private final java.nio.file.Path dir
      • hexchar

        private static final char[] hexchar
    • Constructor Detail

      • FileLfsRepository

        public FileLfsRepository​(java.lang.String url,
                                 java.nio.file.Path dir)
                          throws java.io.IOException

        Constructor for FileLfsRepository.

        Parameters:
        url - external URL of this repository
        dir - storage directory
        Throws:
        java.io.IOException
    • Method Detail

      • getSize

        public long getSize​(AnyLongObjectId id)
                     throws java.io.IOException
        Get size of an object
        Specified by:
        getSize in interface LargeFileRepository
        Parameters:
        id - id of the object
        Returns:
        length of the object content in bytes, -1 if the object doesn't exist
        Throws:
        java.io.IOException
      • getDir

        public java.nio.file.Path getDir()
        Get the storage directory
        Returns:
        the path of the storage directory
      • getPath

        protected java.nio.file.Path getPath​(AnyLongObjectId id)
        Get the path where the given object is stored
        Parameters:
        id - id of a large object
        Returns:
        path the object's storage path
      • getReadChannel

        java.nio.channels.ReadableByteChannel getReadChannel​(AnyLongObjectId id)
                                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • toHexCharArray

        private static char[] toHexCharArray​(int b)
      • formatHexChar

        private static void formatHexChar​(char[] dst,
                                          int p,
                                          int b)
      • getUrl

        public java.lang.String getUrl()
        Returns:
        the url of the content server
        Since:
        4.11
      • setUrl

        public void setUrl​(java.lang.String url)
        Parameters:
        url - the url of the content server
        Since:
        4.11