public class

AbstractFileContentCallback

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

Summary

Public Constructors
AbstractFileContentCallback()
Public Methods
void offerBlame(List<? extends Blame> blames)
If annotations were requested and at least one line was streamed, this method will be called before onEnd(FileSummary) to provide blame for the streamed lines.
void onBinary()
Called once if the file is binary.
void onEnd(FileSummary summary)
Called after the final line, and blame if requested, has been streamed.
boolean onLine(int lineNumber, String line, boolean truncated)
Ignores the provided line details and returns false, which will terminate streaming.
void onStart(FileContext context)
Called before the first onLine(int, String, boolean).
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.stash.content.FileContentCallback

Public Constructors

public AbstractFileContentCallback ()

Public Methods

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

If annotations were requested and at least one line was streamed, this method will be called before onEnd(FileSummary) 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 onEnd(FileSummary). This makes onEnd(FileSummary)'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 onBinary ()

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

Throws
IOException

public void onEnd (FileSummary summary)

Called after the final line, and blame if requested, has been streamed.

Note: If there were no lines, this method may be called immediately after onStart(FileContext) without any calls to onLine(int, String, boolean).

Parameters
summary summarizes the file request and the streamed lines
Throws
IOException

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

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)

Called before the first onLine(int, String, boolean).

Parameters
context provides details about the file request for which lines are being streamed
Throws
IOException