Package org.eclipse.core.filebuffers

# Interface ITextFileBuffer

All Superinterfaces:
  `IFileBuffer`

public interface ITextFileBuffer extends IFileBuffer
A text file buffer is a file buffer for text files. The contents of a text file buffer is given in the form of a document and an associated annotation model. Also, the text file buffer provides methods to manage the character encoding used to read and write the buffer's underlying text file.

Clients are not supposed to implement that interface. Instances of this type are obtained from a `ITextFileBufferManager`.

Since:
  3.0
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Method Summary

Modifier and Type
Method
Description
`IAnnotationModel`
`getAnnotationModel()`
Returns the annotation model of this text file buffer.
`IDocument`
`getDocument()`
Returns the document of this text file buffer.
`String`
`getEncoding()`
Returns the character encoding to be used for reading and writing the buffer's underlying file.
`void`
`setEncoding(String encoding)`
Sets the character encoding to be used for reading and writing the buffer's underlying file.

### Methods inherited from interface org.eclipse.core.filebuffers.IFileBuffer

`commit, computeCommitRule, computeValidateStateRule, getContentType, getFileStore, getLocation, getModificationStamp, getStatus, isCommitable, isDirty, isShared, isStateValidated, isSynchronizationContextRequested, isSynchronized, releaseSynchronizationContext, requestSynchronizationContext, resetStateValidation, revert, setDirty, validateState`

## Method Details

### getDocument

IDocument getDocument()
Returns the document of this text file buffer.

Returns:
  the document of this text file buffer

### getEncoding

String getEncoding()
Returns the character encoding to be used for reading and writing the buffer's underlying file.

Note: The encoding used to write the file might differ from the encoding returned by this method if no encoding has been explicitly set and the content type of the file is derived from the content (e.g. an XML file).

Returns:
  the character encoding

### setEncoding

void setEncoding(String encoding)
Sets the character encoding to be used for reading and writing the buffer's underlying file.

Parameters:
  `encoding` - the encoding

### getAnnotationModel

IAnnotationModel getAnnotationModel()
Returns the annotation model of this text file buffer.

Returns:
  the annotation model of this text file buffer, might be `null` if called when disconnected