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, setIsEmptypublic 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()
DiffContentgetDocument in class DiffContentpublic Navigatable getOpenFileDescriptor(int offset)
DiffContentgetOpenFileDescriptor in class DiffContentoffset - in document returned by DiffContent.getDocument()public VirtualFile getFile()
getFile in class DiffContentpublic FileType getContentType()
getContentType in class DiffContentpublic byte[] getBytes()
getBytes in class DiffContentpublic LineSeparator getLineSeparator()
getLineSeparator in class DiffContentpublic 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)