# Class BufferedResourceNode

java.lang.Object
org.eclipse.compare.BufferedContent
org.eclipse.compare.ResourceNode
org.eclipse.compare.internal.BufferedResourceNode

All Implemented Interfaces:
  `IContentChangeNotifier, IEditableContent, IEditableContentExtension, IEncodedStreamContentAccessor, IModificationDate, IResourceProvider, IStreamContentAccessor, ITypedElement, IStructureComparator`

public class BufferedResourceNode extends ResourceNode
A buffer for a workspace resource.

## Field Summary

### Fields inherited from interface ITypedElement

`FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`BufferedResourceNode(IResource resource)`
Creates a `ResourceNode` for the given resource.

## Method Summary

Modifier and Type
Method
Description
`void`
`commit(IProgressMonitor pm)`
`protected IStructureComparator`
`createChild(IResource child)`
This hook method is called from `getChildren` once for every member of a container resource.
`boolean`
`isDirty()`
`ITypedElement`
`replace(ITypedElement child, ITypedElement other)`
This method is called on a parent to add or remove a child, or to copy the contents of a child.
`void`
`setContent(byte[] contents)`
Sets the contents.

### Methods inherited from class ResourceNode

`createStream, equals, getCharset, getChildren, getContents, getImage, getModificationDate, getName, getResource, getType, hashCode, isEditable, isReadOnly, validateEdit`

### Methods inherited from class BufferedContent

`addContentChangeListener, discardBuffer, fireContentChanged, getContent, removeContentChangeListener`

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BufferedResourceNode

public BufferedResourceNode(IResource resource)
Creates a `ResourceNode` for the given resource.

Parameters:
  `resource` - the resource

## Method Details

### isDirty

public boolean isDirty()

### createChild

protected IStructureComparator createChild(IResource child)
Description copied from class: `ResourceNode`
This hook method is called from `getChildren` once for every member of a container resource. This implementation creates a new `ResourceNode` for the given child resource. Clients may override this method to create a different type of `IStructureComparator` or to filter children by returning `null`.

Overrides:
  `createChild` in class `ResourceNode`
Parameters:
  `child` - the child resource for which a `IStructureComparator` must be returned
Returns:
  a `ResourceNode` for the given child or `null`

### setContent

public void setContent(byte[] contents)
Description copied from class: `BufferedContent`
Sets the contents. Registered content change listeners are notified.

Specified by:
  `setContent` in interface `IEditableContent`
Overrides:
  `setContent` in class `BufferedContent`
Parameters:
  `contents` - the new contents

### commit

public void commit(IProgressMonitor pm) throws CoreException

Throws:
  `CoreException`

### replace

public ITypedElement replace(ITypedElement child, ITypedElement other)
Description copied from interface: `IEditableContent`
This method is called on a parent to add or remove a child, or to copy the contents of a child. What to do is encoded in the two arguments as follows:

add: | dest == null | src != null
remove: | dest != null | src == null
copy: | dest != null | src != null

Specified by:
  `replace` in interface `IEditableContent`
Overrides:
  `replace` in class `ResourceNode`
Parameters:
  `child` - the existing child of this object to be replaced; if `null` a new child can be added.
  `other` - the new child to be added or replaced; if `null` an existing child can be removed.
Returns:
  the argument `dest`