checkpoint
[anneal.git] / src / edu / berkeley / qfat / StlFile.java
index b1eaca6..5a283c9 100644 (file)
@@ -14,6 +14,7 @@ import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.InputStreamReader;
 import java.io.FileInputStream;
+import java.io.InputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
@@ -426,9 +427,8 @@ public class StlFile implements Loader
    *
    * @throws IOException
    */
-  private void readBinaryFile(String file) throws IOException
+    public void readBinaryFile(String file, InputStream data) throws IOException
   {
-    FileInputStream data;                 // For reading the file
     ByteBuffer dataBuffer;                // For reading in the correct endian
     byte[] Info=new byte[80];             // Header data
     byte[] Array_number= new byte[4];     // Holds the number of faces
@@ -447,7 +447,6 @@ public class StlFile implements Loader
     }
     else
     { // It's a local file
-      data = new FileInputStream(file);
 
       // First 80 bytes aren't important
       if(80 != data.read(Info))
@@ -571,7 +570,7 @@ public class StlFile implements Loader
     else
     { // Binary file
       try{
-        readBinaryFile(getFileName());
+          readBinaryFile(getFileName(), new FileInputStream(getFileName()));
       }
       catch(IOException e)
       {