com.intellij.openapi.diff
Class BinaryContent

java.lang.Object
  extended by com.intellij.openapi.diff.DiffContent
      extended by com.intellij.openapi.diff.BinaryContent

public class BinaryContent
extends DiffContent

Represents bytes as content. May has text representaion.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.intellij.openapi.diff.DiffContent
DiffContent.Listener
 
Constructor Summary
BinaryContent(byte[] bytes, java.lang.String charset, FileType fileType)
           
 
Method Summary
 byte[] getBytes()
           
 FileType getContentType()
           
 Document getDocument()
          Represents this content as Document null means content has no text representation
 VirtualFile getFile()
           
 OpenFileDescriptor getOpenFileDescriptor(int offset)
          Provides a way to open given text place in editor null means given offset can't be opened in editor
 boolean isBinary()
          Means this content represents binary data.
 
Methods inherited from class com.intellij.openapi.diff.DiffContent
addListener, fireContentInvalid, fromDocument, fromFile, onAssigned, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryContent

public BinaryContent(byte[] bytes,
                     java.lang.String charset,
                     FileType fileType)
Parameters:
bytes -
charset - use to convert bytes to String. null means bytes can't be converted to text. Has no sense if fileType.isBinary()
fileType - type of content
Method Detail

getDocument

public Document getDocument()
Description copied from class: DiffContent
Represents this content as Document null means content has no text representation

Specified by:
getDocument in class DiffContent

getOpenFileDescriptor

public OpenFileDescriptor getOpenFileDescriptor(int offset)
Description copied from class: DiffContent
Provides a way to open given text place in editor null means given offset can't be opened in editor

Specified by:
getOpenFileDescriptor in class DiffContent
Parameters:
offset - in document returned by DiffContent.getDocument()
Returns:
null

getFile

public VirtualFile getFile()
Specified by:
getFile in class DiffContent
Returns:
null

getContentType

public FileType getContentType()
Specified by:
getContentType in class DiffContent
Returns:
FileType of content. null means use other content's type for this one

getBytes

public byte[] getBytes()
                throws java.io.IOException
Specified by:
getBytes in class DiffContent
Returns:
Binary represntation of content. Should not be null if DiffContent.getFile() returns existing not directory file
Throws:
java.io.IOException

isBinary

public boolean isBinary()
Description copied from class: DiffContent
Means this content represents binary data. It should be used only for byte by byte comparison. E.g. directories aren't binary (in spite of they aren't text)

Overrides:
isBinary in class DiffContent