file
Creates a ContentSource for path within this root.
A relative path is resolved against the root: against FileSystemSource.pathPrefix on the local file system, and against AbstractRepo.rawSourcePrefix for repositories, where the path begins with the branch name (e.g. "main/src/App.kt"). An absolute file path, or for repositories a full URL (one that starts with a scheme such as https://), is used unchanged.
No containment is applied: .. segments and absolute paths escape a FileSystemSource's directory, and a repository reads any full URL, including file: URLs and internal hosts. Validate a path that comes from user input before passing it here. A repository's UrlSource follows no redirect by default, so a redirect cannot take a validated URL to another host, but nothing bounds the size of what it reads or how long it takes unless AbstractRepo.file is given maxBytes and fetchTimeout.
Return
a ContentSource that can be used to read the file's content
Parameters
the path to the file, relative to this root
Creates a UrlSource for path, as file does, with the given timeouts and limits; see UrlSource for each.
Parameters
the path to the file, relative to this root, or a full URL
the maximum time to wait for a connection (default 10 seconds)
the maximum time to wait for data once connected (default 30 seconds)
the maximum time for the whole fetch (default none)
the largest body accepted, in bytes (default no limit)
whether to follow HTTP redirects (default false)
Creates a UrlSource for path with timeouts given as java.time.Duration and every limit, for Java callers: the overload taking Kotlin durations cannot be called from Java.
Parameters
the path to the file, relative to this root, or a full URL
the maximum time to wait for a connection
the maximum time to wait for data once connected
the maximum time for the whole fetch; java.time.Duration.ZERO means none
the largest body accepted, in bytes; Long.MAX_VALUE means no limit
whether to follow HTTP redirects