From 5f23b0ca30316804c5065366c631c8290af4c29f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 17 Mar 2012 21:48:22 +0100 Subject: Adapt to GlueGen IO resource changes URL -> URLConnection for effeciency --- src/demos/dualDepthPeeling/Model.java | 15 +++++---------- src/demos/es2/perftst/PerfTextLoad.java | 16 +++++++++------- 2 files changed, 14 insertions(+), 17 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; diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java index f603796..543ce93 100755 --- a/src/demos/es2/perftst/PerfTextLoad.java +++ b/src/demos/es2/perftst/PerfTextLoad.java @@ -9,9 +9,6 @@ import javax.media.opengl.*; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.texture.*; -import com.jogamp.newt.*; -import com.jogamp.newt.opengl.*; - public class PerfTextLoad extends PerfModule { static final int MAX_TEXTURE_ENGINES = 8; @@ -38,12 +35,17 @@ public class PerfTextLoad extends PerfModule { try { for(int i=0; i