class IntermediateFolderUtils {

    @NonNull
    public synchronized File getContentLocation(
            @NonNull String name,
            @NonNull Set<ContentType> types,
            @NonNull Set<? super Scope> scopes,
            @NonNull Format format) {
        // runtime check these since it's (indirectly) called by 3rd party transforms.
        checkNotNull(name);
        checkNotNull(types);
        checkNotNull(scopes);
        checkNotNull(format);
        checkState(!name.isEmpty());
        checkState(!types.isEmpty());
        checkState(!scopes.isEmpty());

        // search for an existing matching substream.
        for (SubStream subStream : subStreams) {
            // look for an existing match. This means same name, types, scopes, and format.
            if (name.equals(subStream.getName())
                    && types.equals(subStream.getTypes())
                    && scopes.equals(subStream.getScopes())
                    && format == subStream.getFormat()) {
                return new File(rootFolder, subStream.getFilename());
            }
        }

        // didn't find a matching output. create the new output
        SubStream newSubStream = new SubStream(name, nextIndex++, scopes, types, format, true);

        subStreams.add(newSubStream);

        return new File(rootFolder, newSubStream.getFilename());
    }

    public  IntermediateFolderUtils(
            @NonNull File rootFolder,
            @NonNull Set<ContentType> types,
            @NonNull Set<? super Scope> scopes);

}