1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.resources; 12 13 import java.io.InputStream; 14 import org.eclipse.core.runtime.*; 15 16 /** 17 * A storage object represents a set of bytes which can be accessed. 18 * These may be in the form of an <code>IFile</code> or <code>IFileState</code> 19 * or any other object supplied by user code. The main role of an <code>IStorage</code> 20 * is to provide a uniform API for access to, and presentation of, its content. 21 * <p> 22 * Storage objects implement the <code>IAdaptable</code> interface; 23 * extensions are managed by the platform's adapter manager. 24 * <p> 25 * Clients may implement this interface. 26 * </p> 27 * </p> 28 */ 29 public interface IStorage extends IAdaptable { 30 /** 31 * Returns an open input stream on the contents of this storage. 32 * The caller is responsible for closing the stream when finished. 33 * 34 * @return an input stream containing the contents of this storage 35 * @exception CoreException if the contents of this storage could 36 * not be accessed. See any refinements for more information. 37 */ 38 public InputStream getContents() throws CoreException; 39 40 /** 41 * Returns the full path of this storage. The returned value 42 * depends on the implementor/extender. A storage need not 43 * have a path. 44 * 45 * @return the path related to the data represented by this storage or 46 * <code>null</code> if none. 47 */ 48 public IPath getFullPath(); 49 50 /** 51 * Returns the name of this storage. 52 * The name of a storage is synonymous with the last segment 53 * of its full path though if the storage does not have a path, 54 * it may still have a name. 55 * 56 * @return the name of the data represented by this storage, 57 * or <code>null</code> if this storage has no name 58 * @see #getFullPath() 59 */ 60 public String getName(); 61 62 /** 63 * Returns whether this storage is read-only. 64 * 65 * @return <code>true</code> if this storage is read-only 66 */ 67 public boolean isReadOnly(); 68 } 69