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 * 006 */ 007package org.fcrepo.migration.foxml; 008 009import java.io.File; 010import java.io.IOException; 011import java.io.InputStream; 012import java.util.Optional; 013 014/** 015 * An interface representing content that is accessible as an InputStream. 016 * @author mdurbin 017 */ 018public interface CachedContent { 019 020 /** 021 * get input stream. 022 * @return the input stream 023 * @throws IOException IO exception 024 */ 025 public InputStream getInputStream() throws IOException; 026 027 /** 028 * get the file backing the CachedContent if it exists 029 * @return the file 030 */ 031 default Optional<File> getFile() { 032 return Optional.empty(); 033 } 034}