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

Commit

Permalink
improved readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsten Krause committed Aug 2, 2016
1 parent 0c647b2 commit e9ab6dd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DataFetcher fetcher = new BufferedDataFetcher();
byte[] bytes = fetcher.fetch(inputStream);

// copy the content of an InputStream into an OutputStream
fetcher.fetch(inputStream, outputStream);
fetcher.copy(inputStream, outputStream);
```

### Automatic closing of supplied streams
Expand All @@ -83,13 +83,15 @@ in.close();
All methods optionally take a [`DataFetchProgressListener`][DataFetchProgressListener] that gets notified on various points in the lifecycle (`started`, `progressed`, `succeeded` or `failed`, `finished`) of a fetch operation. The [`IdleDataFetchProgressListener`][IdleDataFetchProgressListener] is a convenient base implementation with empty methods.

```java
foo.setContent(new BufferedDataFetcher().fetch(
new FileInputStream(file),
new BufferedDataFetcher().copy(
new FileInputStream(inFile),
new FileOutputStream(outFile),
new IdleDataFetchProgressListener() {
public void onProgress(long bytesFetched) {
System.out.println(bytesFetched + " bytes fetched so far.");
System.out.println(bytesFetched + " bytes copied so far.");
}
},
true,
true
);
```
Expand Down Expand Up @@ -118,4 +120,4 @@ Variations of the buffered copying strategy (e.g. lazy buffer creation, threadsa
[IdleDataFetchProgressListener]: http://markenwerk.github.io/java-utils-data-fetcher/index.html?net/markenwerk/utils/data/fetcher/IdleDataFetchProgressListener.html

[InputStream]: http://docs.oracle.com/javase/8/docs/api/index.html?java/io/InputStream.html
[OutputStream]: http://docs.oracle.com/javase/8/docs/api/index.html?java/io/OutputStream.html
[OutputStream]: http://docs.oracle.com/javase/8/docs/api/index.html?java/io/OutputStream.html

0 comments on commit e9ab6dd

Please sign in to comment.