大多数表现的方法来解析输入流
我想找到解析输入流的最快方法。输入流是动态的,第一行包含所有信息以解析数据。 例如:
key,val
INTEGER,INTEGER
1,5
2,5
为了进行解析,我目前正在使用BufferedReader。我逐行阅读,分开(是分离器),然后分析为开头给出的类型。例如:
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
// ...
String line = reader.readLine();
String[] line = StringUtils.split(stringToSplit, ',');
Integer.parse(line[0]);
我想知道这样做的性能影响是什么,以及我可以做些什么来提高性能?我应该使用字节[]?谢谢 !
I would like to find the fastest way to parse an inputstream. The inputstream is dynamic and the first lines contain all the info to parse the data.
eg:
key,val
INTEGER,INTEGER
1,5
2,5
In order to do the parsing I am currently using a BufferedReader. I read line by line, split on , (which is the separator) and then parse to the type given at the beginning. eg:
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
// ...
String line = reader.readLine();
String[] line = StringUtils.split(stringToSplit, ',');
Integer.parse(line[0]);
I was wondering what is the performance impact of doing that, and what I could do to improve the performance ? Should I use byte[] ? Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论