public class

AbstractFileContentCallback

extends Object
implements FileContentCallback2
java.lang.Object
   ↳ com.atlassian.stash.content.AbstractFileContentCallback

Summary

Public Constructors
AbstractFileContentCallback()
Public Methods
void appendBlame(List<? extends Blame> blames)
If annotations were requested and at least one line was streamed, this method will be called before onEndPage(Page) to provide blame for the streamed lines.
void offerBlame(List<? extends Blame> blames)
Delegates to appendBlame(List) to retain backwards compatibility with FileContentCallback.
void onBinary()
Called once if the file is binary.
void onEnd(FileSummary summary)
Delegates to onEndPage(Page) to retain backwards compatibility with FileContentCallback.
void onEndPage(Page<?> page)
Called after onStartPage(int)
@Deprecated boolean onLine(int lineNumber, String line, boolean truncated)
This method is deprecated. in 2.10 for update in 3.0. This method will not be removed. However, its implementation will be changed to return true instead of false
void onStart(FileContext context)
Delegates to onStartPage(int) to retain backwards compatibility with FileContentCallback.
void onStartPage(int index)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.stash.content.FileContentCallback
From interface com.atlassian.stash.content.FileContentCallback2

Public Constructors

public AbstractFileContentCallback ()

Public Methods

public void appendBlame (List<? extends Blame> blames)

If annotations were requested and at least one line was streamed, this method will be called before onEndPage(Page) to provide blame for the streamed lines.

Warning: The semantics of this method were changed slightly in Stash 2.10. In previous releases it was called after onEndPage(Page). It is now called before onEndPage(Page). This makes onEndPage(Page)'s handling consistent with other callbacks; it is always intended to be the final callback method to be invoked, indicating there is no further data available.

Parameters
blames blame for the streamed lines
Throws
IOException

public void offerBlame (List<? extends Blame> blames)

Delegates to appendBlame(List) to retain backwards compatibility with FileContentCallback.

Parameters
blames passed as-is to appendBlame(List)
Throws
IOException propagated if thrown by appendBlame(List)

public void onBinary ()

Called once if the file is binary. None of the other methods will be called.

Throws
IOException

public void onEnd (FileSummary summary)

Delegates to onEndPage(Page) to retain backwards compatibility with FileContentCallback.

Parameters
summary converted to a Page and passed to onEndPage(Page)
Throws
IOException propagated if thrown by onEndPage(Page)

public void onEndPage (Page<?> page)

Called after onStartPage(int)

Parameters
page information about the page streamed to the callback. The page.getValues() will return null as the callback has already received the data. This is used to know information about the number of elements processed and whether there is more content to be retrieved in the future
Throws
IOException

@Deprecated public boolean onLine (int lineNumber, String line, boolean truncated)

This method is deprecated.
in 2.10 for update in 3.0. This method will not be removed. However, its implementation will be changed to return true instead of false

Ignores the provided line details and returns false, which will terminate streaming.

This is inconsistent with other abstract callbacks, like onChange(Change) and will be changed in the 3.0 release to return true instead. Derived classes which rely on the behaviour of this current implementation should override this method and return false explicitly.

Parameters
lineNumber the line number of the line in the file
line a truncated line of code. The line character limit can be set at a system level via a system property
truncated where the received line was truncated
Returns
  • false, until 3.0
Throws
IOException may be thrown by derived classes

public void onStart (FileContext context)

Delegates to onStartPage(int) to retain backwards compatibility with FileContentCallback.

Parameters
context used to pass getStart() to onStartPage(int)
Throws
IOException propagated if thrown by onStartPage(int)

public void onStartPage (int index)

Called before onLine(int, String, boolean). It provides the callback the index of the first line on the page.

onStart(FileContext) will replace this method in Stash 3.0. Until 3.0, the starting index can be retrieved using the deprecated getStart(). Plugin developers should implement onEnd(FileSummary) and use the FileSummary to retrieve paging details.

Parameters
index the index of the starting element of the page
Throws
IOException