Comments (1)
It is not possible to subscribe to a feed. However it can be implemented by wrapping RssReader in a TimeTask or using ScheduledExecutorService.
Generally it feels like a bad idea to just pass streams around since obviously they do need to be closed.
The underlying resources is automatically closed when reading to the end of the stream. If using methods like Stream::findFirst
, Stream::findAny
, Stream::limit
or any other method that only reads the beginning of the stream then use the try-with-resources statement to close the stream.
var rssReader = new RssReader();
try (var feed = rssReader.read(URL)) {
feed.limit(5)
.map(this::toNews)
.forEach(this::publishFiveLatestNews);
}
It's not any different than just giving us a List and us calling List#stream
Returning a List<Item>
would require the entire feed to be parsed and all items to be kept in memory.
RssReader uses a streaming XML parser that parse Items one by one and keeping one Item in memory at a time per feed.
from rssreader.
Related Issues (20)
- Too Many Open Files HOT 2
- Support read from file HOT 1
- image field/tag missing HOT 2
- JCenter is being sunset HOT 2
- Datetime format not recognized
- Author and pubDate are not set HOT 2
- blank enclosure length leads to exception HOT 1
- Multiple categories HOT 1
- How to extend the class Item? HOT 4
- How to pass some object / parameter into custom RssReader / AbstractRssReader? HOT 4
- How to get the raw string of the RSS xml response? HOT 1
- getPubDateZonedDateTime() throws an Exception instead of returning an empty Optional HOT 5
- Problems with some special date time format(s) HOT 2
- Are the RSS items cached? HOT 2
- java.time.format.DateTimeParseException HOT 5
- How to get all image? HOT 4
- [FEATURE REQUEST] Parse String directly. HOT 1
- "content" tag should be treated separately HOT 1
- Support for multiple instances of Enclosure HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rssreader.