Package com.atlassian.bitbucket.content
Interface FileContentCallback
- All Known Implementing Classes:
AbstractFileContentCallback
public interface FileContentCallback
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidofferBlame(Page<Blame> blames) If annotations were requested and at least onelinewas streamed, this method will be called beforeonEnd(FileSummary)to provideblamefor the streamed lines.voidonBinary()Called once if the file is binary.voidonEnd(FileSummary summary) booleanCalled once for each line in the file.voidonStart(FileContext context) Called before the firstonLine(int, String, boolean).
-
Method Details
-
offerBlame
If annotations were requested and at least onelinewas streamed, this method will be called beforeonEnd(FileSummary)to provideblamefor the streamed lines.- Parameters:
blames-blamefor the streamed lines- Throws:
IOException- may be thrown by implementations which perform I/O.- Since:
- 5.0
-
onBinary
Called once if the file is binary. None of the other methods will be called.- Throws:
IOException- if the callback fails
-
onEnd
Called after the finalline, andblameif requested, has been streamed.Note: If there were no lines, this method may be called immediately after
onStart(FileContext)without any calls toonLine(int, String, boolean).- Parameters:
summary- summarizes the file request and the streamed lines- Throws:
IOException- may be thrown by implementations which perform I/O.
-
onLine
Called once for each line in the file.onStart(FileContext)is called before any invocation of this method.onEnd(FileSummary)is called after all invocations of this method.- Parameters:
lineNumber- the line number of the line in the fileline- a truncated line of code. The line character limit can be set at a system level via a system propertytruncated- where the received line was truncated- Returns:
trueif additional lines should be provided; otherwise,falseif sufficient lines have been processed- Throws:
IOException- if the callback fails
-
onStart
Called before the firstonLine(int, String, boolean).- 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.
-