首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

读取图片最后二个字节码

2012-08-31 
读取图片最后2个字节码public static void main(String[] args) {File filenew File(D:/preparedSource/

读取图片最后2个字节码

public static void main(String[] args) {File file=new File("D:/preparedSource/2/12345678901420111203210722.jpg");RandomAccessFile randomfile=null;int result=0;long len;String str="";try {randomfile=new RandomAccessFile(file,"r");len=randomfile.length();randomfile.seek(len-2);while((result=randomfile.read())!=-1){str += Integer.toHexString(result & 0xff);}System.out.println(str);} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}

?

热点排行