Java caching network files
I'm working on this program that needs to download files from a network. The same file is downloaded many times, so we need to cache them to the local file system. Is there a java library that, given a cache directory, will manage the cache and the downloading of the resources?
The library needs to have some kind of open source license.
Than开发者_如何学编程k you.
URLConnection supports caching, but there is no default cache implementation. See this article for more info: http://download.oracle.com/javase/1.5.0/docs/guide/net/http-cache.html
If you plug in your own cache implementation, you can just use a regular URLConnection to download the item, and your cache will be used.
though NCache is not an open source, but its free version is available, which can serve the purpose for you. once you create the local cache, you can download the files from there.
精彩评论