package com.mooo.aimmac23.hub.videostorage;

import java.io.IOException;
import java.io.InputStream;

public interface StoredVideoDownloadContext {
	
	/**
	 * Was the requested video found?
	 * 
	 * @return
	 */
	boolean isVideoFound();
	
	/**
	 * If the video was found, return an Input stream for the content, or null otherwise.
	 * 
	 * @return
	 */
	InputStream getStream() throws IOException;
	
	/**
	 * 
	 * @return the content length in bytes of the video, or null if we are using a storage
	 * mechanism that doesn't tell us this.
	 */
	Long getContentLengthIfKnown();
	
	/**
	 * Frees any resources allocated to this storage request. Should always be called, even
	 * if the video is not found.
	 * 
	 */
	void close();
	
}

Refactor the video download functionality to be more flexible, and better at cleaning up things
Refactor the video download functionality to be more flexible, and better at cleaning up things
