001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.fcrepo.http.commons.responses;
019
020import static java.util.Objects.requireNonNull;
021
022import java.util.Map;
023
024import org.fcrepo.kernel.api.RdfStream;
025
026/**
027 * A simple type to collect an RdfStream and associated Namespace mappings
028 *
029 * @author acoburn
030 * @since 2/13/16
031 */
032public class RdfNamespacedStream implements AutoCloseable {
033
034    public final RdfStream stream;
035
036    public final Map<String, String> namespaces;
037
038    /**
039     * Creates an object to hold an RdfStream and an associated namespace mapping.
040     *
041     * @param stream the RdfStream
042     * @param namespaces the namespace mapping
043     */
044    public RdfNamespacedStream(final RdfStream stream, final Map<String, String> namespaces) {
045        requireNonNull(stream);
046        requireNonNull(namespaces);
047        this.stream = stream;
048        this.namespaces = namespaces;
049    }
050
051    @Override
052    public void close() {
053        stream.close();
054    }
055}