-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tika: implement Parse and Translate methods that return readers (#34)
Always reading the response body into memory results in unnecessary and undesired allocations, especially when sending large documents to Tika for parsing. The call method, which is called for all API requests, doesn't copy the response anymore. Instead, callString copies it for the methods that return strings and callUnmarshal does its own buffering using the JSON decoder. This commit also creates a new method, ParseReader, which allows users of the client to omit copying the response, but instead receive its reader directly, which they are responsible to close. As with ParseReader, a TranslateReader is provided for the same reasons.
- Loading branch information
Showing
2 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters