trait Resource extends AnyRef
Finds and loads class resources or class loader resources.
The default implementation of this trait is the Resource object, which looks up resources
using the current thread's context class loader.
The Resource object also offers several other Resource implementations,
through its methods at
, from
, and my
. at
searches from a Class,
from
searches from a ClassLoader,
and my
searches from the class, trait, or object surrounding the call.
// Look up the config.properties file for this class or object. Resource.my.asStream("config.properties") // Find logging.properties (in the root package) somewhere on the classpath. Resource.url("logging.properties")
- See also
- Alphabetic
- By Inheritance
- Resource
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asStream(name: String): Option[InputStream]
Look up a resource by name, and open an InputStream for reading it.
Look up a resource by name, and open an InputStream for reading it.
- name
Name of the resource to search for.
- returns
InputStream for reading the found resource, if a resource was found.
- Annotations
- @throws( ... )
- See also
- def asString(name: String, bufferSize: Int = DefaultBufferSize)(implicit charset: Charset = DefaultCharset): Option[String]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
getAsStream(name: String): InputStream
Same as asStream but throws a NoSuchElementException if resource is not found
- def getAsString(name: String, bufferSize: Int = DefaultBufferSize)(implicit charset: Charset = DefaultCharset): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
getUrl(name: String = ""): URL
Get URL of given resource A default argument of empty string is provided to conveniently get the root resource URL using {{Resource.getUrl()}}
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.