为什么要用NIO?我理解的NIO是管道对管道的时候才用的。既然你的文件里面开头就是这个,为什么不自己读了,拿正则搞一下就出来了呀
补充------
package com.huawei.baidu;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexTest {
public static void main(String[] args) {
String regex="(width=)(\\d+);";
String testString="width=123;";
Pattern reg = Pattern.compile(regex);
Matcher regexMatcher = reg.matcher(testString);
if(regexMatcher.find())
{
System.out.println(regexMatcher.group(2));
}
}
}