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.stream.Stream; 011 012import javax.ws.rs.core.Link; 013 014/** 015 * Stream of links for Memento TimeMaps 016 * 017 * @author whikloj 018 * @since 2017-10-24 019 */ 020public class LinkFormatStream implements AutoCloseable { 021 022 private final Stream<Link> stream; 023 024 /** 025 * Constructor 026 * 027 * @param stream the stream of Links 028 */ 029 public LinkFormatStream(final Stream<Link> stream) { 030 requireNonNull(stream); 031 this.stream = stream; 032 } 033 034 /** 035 * Generic getter 036 * 037 * @return the Stream of Links 038 */ 039 public Stream<Link> getStream() { 040 return stream; 041 } 042 043 @Override 044 public void close() { 045 stream.close(); 046 } 047 048}