Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
extended explanations about custom implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsten Krause committed Feb 16, 2016
1 parent 8ae86da commit 5ec1efa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ Missing or invalid arguments are handled gracefully with the following behaviour

This library provides [`BufferedFetcher`][BufferedFetcher] as the simplest possible implementations of [`Fetcher`][Fetcher]. It eagerly allocates a `byte[]` during construction and uses it as a buffer to perform fetch operations by sequentially reading from the [`InputStream`][InputStream] into the buffer and then writing from the buffer to the [`OutputStream`][OutputStream]. It is not threadsafe.

Variations of the buffered copying strategy (e.g. lazy buffer creation, threadsafeness) or completely other copying strategies can easily be implemented by extending [`AbstractBufferedFetcher`][AbstractBufferedFetcher] or [`AbstractFetcher`][AbstractFetcher] respectively.
Variations of the buffered copying strategy (e.g. lazy buffer creation, threadsafeness) or completely other copying strategies can easily be implemented by extending [`AbstractFetcher`][AbstractFetcher] or [`AbstractBufferedFetcher`][AbstractBufferedFetcher] respectively.

[`AbstractFetcher`][AbstractFetcher] reduces all methods from the [`Fetcher`][Fetcher] interface to a single method (`doCopy(InputStream, OutputStream, FetchProgressListener)`) where every parameter is guaranteed to be not `null`, and therefore greatly simplifies the implementation of new fetch strategies. [`AbstractBufferedFetcher`] is such an implementation of the aforementioned buffering fetch strategy that handles the sequentially write-read cycles and notifies the [`FetchProgressListener`][FetchProgressListener] accordingly, but leaves the buffer allocation strategy to be specified.

[AbstractBufferedFetcher]: http://markenwerk.github.io/java-utils-data-fetcher/index.html?net/markenwerk/utils/data/fetcher/package-summary.html
[AbstractFetcher]: http://markenwerk.github.io/java-utils-data-fetcher/index.html?net/markenwerk/utils/data/fetcher/AbstractFetcher.html
Expand Down

0 comments on commit 5ec1efa

Please sign in to comment.