public static void main(String[] args) throws IOException {
String str = "";
//字节缓冲文件读取流
BufferedInputStream br = new BufferedInputStream(new FileInputStream("D:\\temp\\4.1.txt"));
byte[] bytes = new byte[1024];
int len;
//开始读取
while ((len = br.read(bytes)) != -1) {
//字节数组转化为字符串
str = new String(bytes, 0, len);
if (str.contains("PIC_ID ")) {
String s = str.split("= ")[1].split("\n")[0];
System.out.println(s);
}
}
}
Java读取指定文件并判断字符
最新推荐文章于 2022-07-29 16:11:30 发布