Programming - Resources in Beans

java.lang.Class.getResourceAsStream

public InputStream getResourceAsStream(String name)

Finds a resource with a given name. This method returns null if no resource with this name is found. The rules
for searching resources associated with a given class are implemented by the defining class loader of the
class.

This method delegates the call to its class loader, after making these changes to the resource name: if the
resource name starts with "/", it is unchanged; otherwise, the package name is prepended to the resource
name after converting "." to "/". If this object was loaded by the bootstrap loader, the call is delegated to
ClassLoader.getSystemResourceAsStream.


Parameters: name - name of the desired resource
Returns:a java.io.InputStream object.
Since: JDK1.1
See Also: ClassLoader


java.lang.Class.getResource

public URL getResource(String name)

Finds a resource with a given name. This method returns null if no resource with this name is found. The rules
for searching resources associated with a given class are implemented by the * defining class loader of the
class.

This method delegates the call to its class loader, after making these changes to the resource name: if the
resource name starts with "/", it is unchanged; otherwise, the package name is prepended to the resource
name after converting "." to "/". If this object was loaded by the bootstrap loader, the call is delegated to
ClassLoader.getSystemResource.
Parameters: name - name of the desired resource
Returns: a java.net.URL object.
Since: JDK1.1
See Also: ClassLoader


java.net.URL.getContent

public final Object getContent()
throws IOException

Returns the contents of this URL. This method is a shorthand for:

openConnection().getContent()

Returns: the contents of this URL.
Throws: IOException - if an I/O exception occurs.
See Also: URLConnection.getContent()


metadata block
see also:

Beans in mjbWorld -- Architecture

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover This book may be useful if you are using JBuilder. Learn Java with Jbuilder 6 - Introduces Java language and Swing from a practical, step by step, rather than theoretical point of view. JBuilder 8 has now been introduced so there may be a few difference if you are using the latest version of JBuilder.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover JBuilder - There is also a free version of Jbuilder at borland website . However its licence conditions are quite restrictive so you may prefer another java IDE.

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.