开发者

How exactly does URLClassLoader work? java

开发者 https://www.devze.com 2023-04-10 14:06 出处:网络
So I know how to use URLClassLoader, and I know what it does, what I want to know is how exactly does it do it.

So I know how to use URLClassLoader, and I know what it does, what I want to know is how exactly does it do it.

Basically I'm asking: Is it a live stream? Or does it do a temporary download and reads the classes lo开发者_如何学编程cally?

So if you where continually calling a method from a class you are loading with the URLClassLoader and you lost internet randomly would your java snip-it fail?

Or is it a one time thing and downloads it and if you lost internet it would be ok because it already downloaded it at the beginning?

Any information would be awesome, thank you.


No. The classloader loads and caches content from the URL and does not refetch.

All custom class loader implementations have to work through defineClass which takes a byte[]. No streaming is possible with this API -- you either have all the bytes for the class or you don't.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号