forked from ScottOaks/JavaPerformanceTuning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunParams.java
More file actions
46 lines (38 loc) · 1.15 KB
/
Copy pathRunParams.java
File metadata and controls
46 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (c) 2013,2014 Scott Oaks. All rights reserved.
*/
package net.sdo;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class RunParams {
private Properties props;
public RunParams(String filename) throws IOException {
props = new Properties();
props.load(new FileReader(filename));
}
public byte[] getInput() throws IOException {
byte[] b;
InputStream is = new FileInputStream(props.getProperty("inputFile"));
int size = is.available();
b = new byte[size];
is.read(b);
is.close();
return b;
}
public String getClassName() {
return props.getProperty("className");
}
public int getTargetItemCount() {
String s = props.getProperty("targetItemCount");
if (s == null) {
return Integer.MAX_VALUE;
}
return Integer.parseInt(s);
}
public String getSchemaFileName() {
return props.getProperty("schemaFileName");
}
}