File file=new File("D:\\02\\recv\\OFD_2_646_20161110_07.txt");//获取要读取的文件绝对路径
try {
FileInputStream fileInputStream=new FileInputStream(file);//用File读取流读取
byte[] b=new byte[1024];//用字节数组来解析文件
int count=0;
if ((count=fileInputStream.read(b))!=-1) {//从read读取文件 存在字节数组中 返回的是字节总数
System.out.write(b, 12, count); //输出流 输出字符数组 从指定下标到指定下标
}
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
FileInputStream fileInputStream=new FileInputStream(file);//用File读取流读取
byte[] b=new byte[1024];//用字节数组来解析文件
int count=0;
if ((count=fileInputStream.read(b))!=-1) {//从read读取文件 存在字节数组中 返回的是字节总数
System.out.write(b, 12, count); //输出流 输出字符数组 从指定下标到指定下标
}
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}