static boolean load(
            TraitFactory traitFactory,
            Map<String, Object> properties,
            String filename,
            Consumer<LoadOperation> operationConsumer,
            Supplier<InputStream> contentSupplier,
            Function<CharSequence, String> stringTable
    ) {
        try {
            if (filename.endsWith(".smithy")) {
                try (InputStream inputStream = contentSupplier.get()) {
                    String contents = IoUtils.toUtf8String(inputStream);
                    new IdlModelLoader(filename, contents, stringTable).parse(operationConsumer);
                }
                return true;
            } else if (filename.endsWith(".jar")) {
                loadJar(traitFactory, properties, filename, operationConsumer, stringTable);
                return true;
            } else if (filename.endsWith(".json") || filename.equals(SourceLocation.NONE.getFilename())) {
                try (InputStream inputStream = contentSupplier.get()) {
                    // Assume it's JSON if there's an N/A filename.
                    return loadParsedNode(Node.parse(inputStream, filename), operationConsumer);
                }
            } else {
                LOGGER.warning(() -> "Ignoring unrecognized Smithy model file: " + filename);
                return false;
            }
        } catch (IOException e) {
            throw new ModelImportException("Error loading " + filename + ": " + e.getMessage(), e);
        }
    }
Parses models and pushes {@link LoadOperation}s to the given consumer.

<p>The format contained in the supplied {@code InputStream} is
determined based on the file extension in the provided
{@code filename}.

@param traitFactory Factory used to create traits.
@param properties Bag of loading properties.
@param filename Filename to assign to the model.
@param operationConsumer Where loader operations are published.
@param contentSupplier The supplier that provides an InputStream. The
  supplied {@code InputStream} is automatically closed when the loader
  has finished reading from it.
@return Returns true if the file was loaded. Some JSON files might be ignored and return false.
@throws SourceException if there is an error reading from the contents.
smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelLoader.java