Mercurial > hg > ristipolku
annotate game/ResourceLoader.java @ 194:f8626a142c4d
Adjust scoring method.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Apr 2019 15:43:24 +0300 |
parents | 8dbaa093c562 |
children | 2e7b28b058a7 |
rev | line source |
---|---|
18 | 1 /* |
2 * Ristipolku Resource Loader | |
151 | 3 * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org> |
18 | 4 */ |
5 package game; | |
6 | |
7 import java.util.*; | |
8 import java.io.*; | |
9 import java.net.*; | |
10 | |
11 | |
12 public class ResourceLoader | |
13 { | |
14 InputStream stream; | |
15 String name; | |
16 URL resourceURL; | |
17 | |
18 public ResourceLoader(String name) | |
19 { | |
20 this.name = name; | |
21 resourceURL = getClass().getClassLoader().getResource(name); | |
22 if (resourceURL != null) | |
23 stream = getClass().getClassLoader().getResourceAsStream(name); | |
134
4c0dec72e2f0
Whitespace cosmetic cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
24 |
192
8dbaa093c562
Improve debug message handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
25 G.debug("ResourceLoader('"+ name +"'): "+ resourceURL +" - "+ stream +"\n"); |
18 | 26 } |
134
4c0dec72e2f0
Whitespace cosmetic cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
27 |
18 | 28 public InputStream getStream() |
29 { | |
30 return stream; | |
31 } | |
134
4c0dec72e2f0
Whitespace cosmetic cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
32 |
18 | 33 public URL getURL() |
34 { | |
35 return resourceURL; | |
36 } | |
37 } |