private LineNumberReader openSourceLocation(FromSourceLocation source) {
        try {
            // Ensure that there's a scheme.
            SourceLocation location = source.getSourceLocation();
            String normalizedFile = location.getFilename();

            // Refuse to open URLs that are not files or JARs by forcing the file protocol.
            if (!location.getFilename().startsWith("file:") && !location.getFilename().startsWith("jar:")) {
                normalizedFile = "file:" + normalizedFile;
            }

            // Loading from a JAR needs special treatment, but this can
            // all actually be handled in a uniform way using URLs.
            URL url = new URL(normalizedFile);
            URLConnection connection = url.openConnection();
            connection.setUseCaches(false);

            return new LineNumberReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
        } catch (IOException e) {
            throw new UncheckedIOException("Unable to load source location context for " + source, e);
        }
    }
This class loads model files into memory, one at a time, and either shows leading lines up to a source location or
shows lines that are relevant to a source location use context from a {@link Model}.

<p>Sort sequences of {@link SourceLocation}s before calling {@link #loadContext(FromSourceLocation)} to avoid
needing to open and parse the same file more than once.

@see SourceContextLoader#createLineBasedLoader
@see SourceContextLoader#createModelAwareLoader
smithy-model/src/main/java/software/amazon/smithy/model/loader/sourcecontext/DefaultSourceLoader.java