string.parse(“(”) error
我有一个文件,其中包含如下数据:
recv(1178884, NULL, 4294967267, 0) = 0
......
......
我的源代码是:
try (BufferedReader br = new BufferedReader(new FileReader("D:\\smsTrace.txt"))) {
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
String sysCallName = sCurrentLine;
String[] sysCallTokens = sysCallName.split("(");
System.out.println(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
}
当我拆分它时工作正常,但是当我如上所述使用时,它会引发以下异常。sysCallName.split(",")
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed group near index 1
(
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.accept(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.split(Unknown Source)
at java.lang.String.split(Unknown Source)
at fileReading.main(fileReading.java:19)
你知道我做错了什么吗?