急用,谢谢请帮忙!
3条回答 默认 最新
chengming5460 2010-01-03 15:32关注[code="java"]public class test {
public static void main(String[] args) {
byte[] tempchars = new byte[1];
File file = new File("d:/log.txt");
InputStream str = null;
try {
str = new FileInputStream(file);
try {
str.skip(9);//跳过前9个字节
int read = str.read(tempchars, 0, 1);//读取一个字节赋值给tempchars
str.close();
System.out.println("read="+read);
System.out.println("tempchars="+tempchars[0]);
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}[/code]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报