| com.atlassian.stash.content.FileContentCallback |
Known Indirect Subclasses
|
Class Overview
A callback for the contents of a file
Note: Implementors are
strongly encouraged to extend from
AbstractFileContentCallback. This interface
will change, over time, and any class implementing it directly will be broken by such changes. Extending from
the abstract class will help prevent such breakages.
Warning: The semantics of
blame were changed slightly in Stash 2.10. Previously
offerBlame(List) was called
after onEndPage(Page). For 2.10+,
offerBlame(List)
is now called
before onEnd(FileSummary). This makes
onEnd(FileSummary)'s behaviour
consistent with other callbacks; it is always intended to be the
final callback method to be invoked,
indicating there is no further data available so that callback implementations can wrap up their processing.
Summary
| 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)
Called once for each line in the file.
|
|
void
|
onStart(FileContext context)
|
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
| May be thrown by implementations which perform I/O.
|
public
void
onBinary
()
Called once if the file is binary. None of the other methods will be called.
Throws
| IOException
| if the callback fails
|
public
void
onEnd
(FileSummary summary)
Parameters
| summary
| summarizes the file request and the streamed lines |
Throws
| IOException
| may be thrown by implementations which perform I/O.
|
public
boolean
onLine
(int lineNumber, String line, boolean truncated)
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
true if additional lines should be provided; otherwise, false if sufficient lines have
been processed
Throws
| IOException
| if the callback fails
|
public
void
onStart
(FileContext context)
Parameters
| context
| provides details about the file request for which lines are being streamed |
Throws
| IOException
| may be thrown by implementations which perform I/O.
|