Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
w3stling committed Dec 1, 2024
1 parent 6b2e6fa commit 1360872
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@ List<Item> footballArticles = rssFeed.filter(i -> i.getTitle().equals(Optional.o
```

### Read feed from a file
Reading from file using InputStream
```java
InputStream file = new FileInputStream("Path to file");
List<Item> items = new RssReader().read(file);
InputStream inputStream = new FileInputStream("/path/to/file");
List<Item> items = new RssReader().read(inputStream);
.toList();
```

Reading from file using file URI
```java
List<Item> items = new RssReader().read("file:/path/to/file");
.toList();
```


### Read from multiple feeds
Read from multiple feeds into a single stream of items sored in descending (newest first) publication date order and prints the title.
```java
Expand All @@ -62,7 +70,12 @@ new RssReader().read(urls)

To change sort order to ascending (oldest first) publication date
```java
.sorted(ItemComparator.oldestItemFirst())
.sorted(ItemComparator.oldestPublishedItemFirst())
```
For sorting on updated date instead of publication date
```java
.sorted(ItemComparator.newestUpdatedItemFirst())
.sorted(ItemComparator.oldestUpdatedItemFirst())
```


Expand Down

0 comments on commit 1360872

Please sign in to comment.