Interface ReportRenderer
- All Known Implementing Classes:
PdfRenderer
public interface ReportRenderer
把 ReportDocument 輸出成特定格式
實作可重用且 thread-safe,同一個 renderer 可同時處理多份文件。
輸出語意:render 以第一個位元組寫入 out 為界分為兩階段。產生階段(排版、繪製、序列化到 renderer 自己的暫存檔)
的任何失敗或取消都不會寫出任何位元組;寫出階段只是把完成的檔案複製到 out,此時 out 丟出例外則 out 可能已有部分內容,
呼叫者必須丟棄。out 不會被關閉。
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionrender(ReportDocument document, RenderOptions options) 產生到 renderer 的暫存檔並回傳產物render(ReportDocument document, OutputStream out, RenderOptions options) 輸出文件
-
Method Details
-
render
輸出文件- Parameters:
document- 文件out- 輸出目的地;不會被關閉options- 單次 render 的選項- Returns:
- 結果,只含 INFO 與 WARNING diagnostic
- Throws:
ReportValidationException- 模型或排版無法產生正確輸出(ERROR);out未被寫入ReportRenderCancelledException- 產生階段中被取消;out未被寫入UncheckedIOException- I/O 失敗;若發生在寫出階段,out可能已有部分內容
-
render
產生到 renderer 的暫存檔並回傳產物
回傳的 artifact 由呼叫者擁有,必須關閉(或交給會接手 ownership 的 helper,例如
StoredReports.save(FileStorage, String, ReportArtifact)與ReportResponses);關閉後刪除暫存檔。失敗或取消時不回傳 artifact,暫存檔已刪除。- Parameters:
document- 文件options- 單次 render 的選項- Returns:
- 完整、可讀取的產物
- Throws:
ReportValidationException- 模型或排版無法產生正確輸出(ERROR)ReportRenderCancelledException- 產生階段中被取消UncheckedIOException- I/O 失敗
-