|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.compare.BufferedContent
public abstract class BufferedContent
Abstract implementation for a buffered IStreamContentAccessor.
Subclasses must implement the createStream method
to connect the buffered content with a streamable source (e.g., a file).
As long as the contents of BufferedContent is only retrieved as an input stream
(by means of getContents) and the BufferedContent is not modified (with
setContent) no buffering takes place.
Buffering starts when either method getContent or setContent is called.
IContentChangeNotifier,
IStreamContentAccessor| Constructor Summary | |
|---|---|
protected |
BufferedContent()
Creates a buffered stream content accessor. |
| Method Summary | |
|---|---|
void |
addContentChangeListener(IContentChangeListener listener)
Adds a content change listener to this notifier. |
protected abstract java.io.InputStream |
createStream()
Creates and returns a stream for reading the contents. |
void |
discardBuffer()
Discards the buffered content. |
protected void |
fireContentChanged()
Notifies all registered IContentChangeListeners of a content change. |
byte[] |
getContent()
Returns the contents as an array of bytes. |
java.io.InputStream |
getContents()
Returns an open InputStream for this object which can be used to retrieve the object's content. |
void |
removeContentChangeListener(IContentChangeListener listener)
Removes the given content changed listener from this notifier. |
void |
setContent(byte[] contents)
Sets the contents. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected BufferedContent()
| Method Detail |
|---|
public java.io.InputStream getContents()
throws CoreException
IStreamContentAccessorInputStream for this object which can be used to retrieve the object's content.
The client is responsible for closing the stream when finished.
Returns null if this object has no streamable contents.
getContents in interface IStreamContentAccessorCoreException - if the contents of this object could not be accessed
protected abstract java.io.InputStream createStream()
throws CoreException
Subclasses must implement this method.
CoreException - if the contents could not be accessedpublic void setContent(byte[] contents)
contents - the new contentspublic byte[] getContent()
null if
the contents could not be accessedpublic void discardBuffer()
public void addContentChangeListener(IContentChangeListener listener)
IContentChangeNotifier
addContentChangeListener in interface IContentChangeNotifierlistener - a content changed listenerpublic void removeContentChangeListener(IContentChangeListener listener)
IContentChangeNotifier
removeContentChangeListener in interface IContentChangeNotifierlistener - a content changed listenerprotected void fireContentChanged()
IContentChangeListeners of a content change.
|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.