001/**
002 * Copyright (C) 2014  Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
003 *
004 * This file is part of Dicoogle/dicoogle-sdk.
005 *
006 * Dicoogle/dicoogle-sdk is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Dicoogle/dicoogle-sdk is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with Dicoogle.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package pt.ua.dicoogle.sdk;
020
021import java.io.IOException;
022import java.io.InputStream;
023import java.net.URI;
024
025/** An entity containing the means to read a file or a blob via Dicoogle.
026 * Instances of this class are returned when asking for listings of resources, and do not open an input
027 * stream automatically, thus why the class does not extend {@code InputStream}.
028 * 
029 * @author Frederico Valente
030 * @author Luís A. Bastião Silva <bastiao@ua.pt>
031 */
032public interface StorageInputStream {
033    /** Obtains the file's path.
034     * 
035     * @return the URI path of the file
036     */
037    public abstract URI getURI();
038    
039    /** Obtains a new input stream for reading the file.
040     * 
041     * @return a new input stream
042     * @throws IOException if an I/O error occurs
043     */
044    public abstract InputStream getInputStream() throws IOException;
045    
046    /** Obtains the file's size.
047     * 
048     * @return the storage element's size in byte
049     * @throws IOException if an I/O error occurs
050     */
051    public abstract long getSize() throws IOException;
052}