summaryrefslogtreecommitdiffstats
path: root/src/demos/dualDepthPeeling
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-17 21:48:22 +0100
committerSven Gothel <[email protected]>2012-03-17 21:48:22 +0100
commit5f23b0ca30316804c5065366c631c8290af4c29f (patch)
treebf0f57c89bea10b85ab711a2e79664f2e6650233 /src/demos/dualDepthPeeling
parent87470a5a0d41c3eb1e54da1c388c4f56283bd9b1 (diff)
Adapt to GlueGen IO resource changes URL -> URLConnection for effeciency
Diffstat (limited to 'src/demos/dualDepthPeeling')
-rw-r--r--src/demos/dualDepthPeeling/Model.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/demos/dualDepthPeeling/Model.java b/src/demos/dualDepthPeeling/Model.java
index d0dc8f3..c67c9b1 100644
--- a/src/demos/dualDepthPeeling/Model.java
+++ b/src/demos/dualDepthPeeling/Model.java
@@ -17,11 +17,10 @@ package demos.dualDepthPeeling;
import java.io.BufferedReader;
-import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.URL;
+import java.net.URLConnection;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.HashMap;
@@ -96,13 +95,13 @@ public class Model {
//
//////////////////////////////////////////////////////////////
public boolean loadModelFromFile( Class<?> context, String file ) {
- URL fileURL = IOUtil.getResource(context, file);
- if ( fileURL != null )
+ URLConnection conn = IOUtil.getResource(context, file);
+ if ( conn != null )
{
BufferedReader input = null;
try {
- input = new BufferedReader(new InputStreamReader(fileURL.openStream()));
+ input = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
float[] val = new float[4];
int[][] idx = new int[3][3];
@@ -215,11 +214,7 @@ public class Model {
} catch (NumberFormatException kIO) {
System.err.println("Problem reading the shader file " + file);
} finally {
- try {
- if (input != null) {
- input.close();
- }
- } catch (IOException closee) {}
+ IOUtil.close(input, false);
}
}
return false;