我有一个java服务器应用程序,下载CSV文件并解析它.解析可能需要5到45分钟,并且每小时发生一次.这种方法是应用程序的瓶颈,因此它不是过早的优化.到目前为止的代码:
client.executeMethod(method);
InputStream in = method.getResponseBodyAsStream(); // this is http stream
String line;
String[] record;
reader = new BufferedReader(new InputStreamReader(in), 65536);
try {
// read the header line
line = reader.readLine();
// some code
while ((line = reader.readLine()) != null) {
// more code
line = line.replaceAll("\"\"", "\"NULL\"");
// Now remove all of the quotes
line = line.replaceAll("\"", "");
if (!line.startsWith("ERROR"){
//bla bla
continue;
}
record = line.split(",");
//more error handling
// build the object and put it in HashMap …Run Code Online (Sandbox Code Playgroud) 我现在一直在谷歌搜索大约一小时,我仍然不清楚单身是什么.任何人都可以让我更清楚,也许发布一个代码示例?
我只知道你是否只能拥有一个给定类的一个实例.但是你不能只用那个静态类吗?
提前致谢!