public class SimpleContent extends DiffContent
getText()
,
setReadOnly(boolean)
Constructor and Description |
---|
SimpleContent(java.lang.String text)
Constructs content with given text and null type
|
SimpleContent(java.lang.String text,
FileType type) |
Modifier and Type | Method and Description |
---|---|
static SimpleContent |
createEmpty() |
static SimpleContent |
fromBytes(byte[] bytes,
java.lang.String charset,
FileType fileType) |
static DiffContent |
fromIoFile(java.io.File file,
java.lang.String charset,
FileType fileType) |
byte[] |
getBytes() |
java.nio.charset.Charset |
getCharset() |
FileType |
getContentType() |
Document |
getDocument()
Represents this content as Document
null means content has no text representation
|
VirtualFile |
getFile() |
LineSeparator |
getLineSeparator() |
Navigatable |
getOpenFileDescriptor(int offset)
Provides a way to open given text place in editor
null means given offset can't be opened in editor
|
java.lang.String |
getText() |
void |
setBOM(byte[] BOM) |
void |
setCharset(java.nio.charset.Charset charset) |
void |
setReadOnly(boolean readOnly)
Make this content editable or not.
|
fromDocument, fromFile, isBinary, isEmpty, setIsEmpty
public SimpleContent(java.lang.String text)
public SimpleContent(java.lang.String text, FileType type)
public static SimpleContent createEmpty()
public void setReadOnly(boolean readOnly)
public java.lang.String getText()
setReadOnly(boolean)
public Document getDocument()
DiffContent
getDocument
in class DiffContent
public Navigatable getOpenFileDescriptor(int offset)
DiffContent
getOpenFileDescriptor
in class DiffContent
offset
- in document returned by DiffContent.getDocument()
public VirtualFile getFile()
getFile
in class DiffContent
public FileType getContentType()
getContentType
in class DiffContent
public byte[] getBytes()
getBytes
in class DiffContent
public LineSeparator getLineSeparator()
getLineSeparator
in class DiffContent
public java.nio.charset.Charset getCharset()
public void setCharset(java.nio.charset.Charset charset)
public static SimpleContent fromBytes(byte[] bytes, java.lang.String charset, FileType fileType) throws java.io.UnsupportedEncodingException
bytes
- binary text representationcharset
- name of charset. If null IDE default charset will be usedfileType
- content type. If null file name will be used to select file typejava.io.UnsupportedEncodingException
- On encoding errors.public static DiffContent fromIoFile(java.io.File file, java.lang.String charset, FileType fileType) throws java.io.IOException
file
- should exist and not to be a directorycharset
- name of file charset. If null IDE default charset will be usedfileType
- content type. If null file name will be used to select file typejava.io.IOException
- On I/O errors.public void setBOM(byte[] BOM)