001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.http.commons.responses;
007
008import static java.util.Objects.requireNonNull;
009
010import java.util.Map;
011
012import org.fcrepo.kernel.api.RdfStream;
013
014/**
015 * A simple type to collect an RdfStream and associated Namespace mappings
016 *
017 * @author acoburn
018 * @since 2/13/16
019 */
020public class RdfNamespacedStream implements AutoCloseable {
021
022    public final RdfStream stream;
023
024    public final Map<String, String> namespaces;
025
026    /**
027     * Creates an object to hold an RdfStream and an associated namespace mapping.
028     *
029     * @param stream the RdfStream
030     * @param namespaces the namespace mapping
031     */
032    public RdfNamespacedStream(final RdfStream stream, final Map<String, String> namespaces) {
033        requireNonNull(stream);
034        requireNonNull(namespaces);
035        this.stream = stream;
036        this.namespaces = namespaces;
037    }
038
039    @Override
040    public void close() {
041        stream.close();
042    }
043}