1 /******************************************************************************* 2 * Copyright (c) 2006 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.ui.internal.ide.undo; 12 13 import java.io.InputStream; 14 15 import org.eclipse.core.runtime.CoreException; 16 17 /** 18 * IFileContentDescription is a description of a file's content. 19 * 20 * This class is not intended to be instantiated or used by clients. 21 * 22 * @since 3.3 23 * 24 */ 25 public interface IFileContentDescription { 26 /** 27 * Returns an open input stream on the contents of the file described. The 28 * client is responsible for closing the stream when finished. 29 * 30 * @return an input stream containing the contents of the file 31 * @throws CoreException 32 * any CoreException encountered retrieving the contents 33 */ 34 public InputStream getContents() throws CoreException; 35 36 /** 37 * Returns whether this file content description still exists. If it does 38 * not exist, it will be unable to produce the contents. 39 * 40 * @return <code>true</code> if this description exists, and 41 * <code>false</code> if it does not 42 */ 43 public boolean exists(); 44 45 /** 46 * Returns the name of a charset encoding to be used when decoding the 47 * contents into characters. Returns <code>null</code> if a charset 48 * has not been explicitly specified. 49 * 50 * @return the name of a charset, or <code>null</code> 51 * @throws CoreException 52 * any CoreException encountered while determining the character 53 * set 54 * 55 */ 56 public String getCharset() throws CoreException; 57 }