How exactly does URLClassLoader work? java
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.
精彩评论