Package rosequartz.files
Class Resource
java.lang.Object
rosequartz.files.Resource
Represents a game resource, like an image, an audio file or just a simple test file.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Resource
Loads a resource from a path inside the resource directory from disk. If a resource has already been loaded before, it is not read from disk.- Parameters:
path- the file path relative to the resource directory
-
Resource
Loads a resource from a path inside the resource directory from disk. If a resource has already been loaded before and forceDiskRead is false, it is not read from disk.- Parameters:
path- the file path relative to the resource directoryforceDiskRead- force resource to be read from disk again
-
-
Method Details
-
getPath
Gets the path of the resource relative to the resource directory.- Returns:
- resource path relative to the resource directory
-
toString
Converts the resource to a string. The bytes are interpreted as UTF-8. -
getLines
Returns an array of all lines of the resource as a string. The bytes are interpreted as UTF-8.- Returns:
- the lines of the content of the resource as a UTF-8 string.
-
forget
Forgets the Resource for this path. This saves memory if the resource is no longer needed, but makes the next created Resource object for this file load from disk again.- Returns:
- this
-
_getNativeResource
-