package org.simantics.modelica.reader;\r
\r
+import java.io.BufferedInputStream;\r
import java.io.File;\r
import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.util.ArrayList;\r
Integer index = indices.get(item);\r
if (index == null)\r
throw new IOException("Unknown item: " + item);\r
- InputStream in = new FileInputStream(file);\r
+ InputStream in = openStream();\r
skip(dataMark, in);\r
\r
Object data = readRow(dataHeader, index, in);\r
Integer index = indices.get(item);\r
if (index == null)\r
throw new IOException("Unknown item: " + item);\r
- InputStream in = new FileInputStream(file);\r
+ InputStream in = openStream();\r
skip(dataMark, in);\r
\r
Object data = readRow(dataHeader, index, start, count, skip, in);\r
indexes.add(index);\r
}\r
\r
- InputStream in = new FileInputStream(file);\r
+ InputStream in = openStream();\r
skip(dataMark, in);\r
\r
\r
\r
}\r
\r
+ private InputStream openStream() throws FileNotFoundException {\r
+ return new BufferedInputStream(new FileInputStream(file));\r
+ }\r
+ \r
@Override\r
public double[][] readData(List<String> items, int start, int count,\r
int skip) throws IOException {\r
indexes.add(index);\r
}\r
\r
- InputStream in = new FileInputStream(file);\r
+ InputStream in = openStream();\r
skip(dataMark, in);\r
\r
\r
\r
\r
private void readVariables() throws IOException {\r
- InputStream in = new FileInputStream(file);\r
+ InputStream in = openStream();\r
readMatrix(in); // Header\r
StringMatrix names = (StringMatrix)readMatrix(in); // Variable names\r
readMatrix(in); // Variable descriptions\r
String name;\r
\r
public MatrixHeader(InputStream in) throws IOException{\r
- int s = readBytes;\r
+ //int s = readBytes;\r
type = getInt(in);\r
rows = getInt(in);\r
columns = getInt(in);\r