1 /******************************************************************************* 2 * Copyright (c) 2000, 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.core.filebuffers; 12 13 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.jface.text.source.IAnnotationModel; 16 17 /** 18 * A text file buffer is a file buffer for text files. The contents of a text 19 * file buffer is given in the form of a document and an associated annotation 20 * model. Also, the text file buffer provides methods to manage the character 21 * encoding used to read and write the buffer's underlying text file. 22 * <p> 23 * Clients are not supposed to implement that interface. Instances of this type 24 * are obtained from a {@link org.eclipse.core.filebuffers.ITextFileBufferManager}. 25 * </p> 26 * 27 * @since 3.0 28 */ 29 public interface ITextFileBuffer extends IFileBuffer { 30 31 /** 32 * Returns the document of this text file buffer. 33 * 34 * @return the document of this text file buffer 35 */ 36 IDocument getDocument(); 37 38 /** 39 * Returns the character encoding to be used for reading and writing the 40 * buffer's underlying file. 41 * <p> 42 * <strong>Note:</strong> The encoding used to write the file might differ from 43 * the encoding returned by this method if no encoding has been explicitly 44 * set and the content type of the file is derived from the content (e.g. 45 * an XML file). 46 * </p> 47 * 48 * @return the character encoding 49 */ 50 String getEncoding(); 51 52 /** 53 * Sets the character encoding to be used for reading and writing the buffer's 54 * underlying file. 55 * 56 * @param encoding the encoding 57 */ 58 void setEncoding(String encoding); 59 60 /** 61 * Returns the annotation model of this text file buffer. 62 * 63 * @return the annotation model of this text file buffer 64 */ 65 IAnnotationModel getAnnotationModel(); 66 } 67