package com.atlassian.bitbucket.io;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.OutputStream;

/**
 * OutputSupplier-style interface.
 *
 */
@FunctionalInterface
public interface TypeAwareOutputSupplier {
    /**
     * Returns an OutputStream, given the supplied content-type. This gives the implementation a chance to do something
     * specific with the content type, like setting a header in the response for instance.
     *
     * @param contentType a content-type to set - must always be provided.
     * @return an OutputStream
     * @throws IOException
     */
    @Nonnull
    OutputStream getStream(@Nonnull String contentType) throws IOException;
}
