sitelink1 http://blog.naver.com/lseykwang?Redirect...0045269556 
sitelink2 https://blog.naver.com/madosa3000/220833610196 
sitelink3  
sitelink4  
sitelink5  
sitelink6  

 

·미리보기 | 소스복사·
 
  1. public long getFileCRC32(String fileName) throws IOException {   
  2.     long crc32Int = -1;   
  3.     CRC32 crc32 = new CRC32();   
  4.   
  5.     CheckedInputStream in = null;   
  6.   
  7.     try {   
  8.         in = new CheckedInputStream(new FileInputStream(fileName), crc32);   
  9.         while (in.read() != -1);   
  10.         crc32Int = crc32.getValue();   
  11.     } catch (FileNotFoundException e) {   
  12.         System.err.println("CheckedIODemo: " + e);   
  13.         System.exit(-1);   
  14.     } catch (IOException e) {   
  15.         System.err.println("CheckedIODemo: " + e);   
  16.         System.exit(-1);   
  17.     } finally {   
  18.         if(in != null) {   
  19.             in.close();       
  20.         }   
  21.     }   
  22.   
  23.     return crc32Int;   
  24. }  


사용법 => long crc32Value = getFileCRC32("c:test.txt");

 

번호 제목 글쓴이 날짜 조회 수
183 Java6 에서 지원하는 Scripting (번역중) 황제낙엽 2010.05.28 560
182 RMI 시작하기(2) file 황제낙엽 2010.05.27 544
181 RMI 시작하기(1) file 황제낙엽 2010.05.27 469
180 Java Remote Method Invocation (Java RMI) 황제낙엽 2010.05.27 477
179 javax.script API 관련 스크랩 (ScriptEngine, ScriptEngineManager) 황제낙엽 2010.05.25 480
178 java.util.Properties 파일 사용 예제 file 황제낙엽 2010.04.06 461
177 10진수 <-> 16진수(Hex) 변환 file 황제낙엽 2010.03.29 1561
176 ServletConfig 이용하기 황제낙엽 2010.03.15 495
175 16비트 CRC 체크용 클래스 (사용자 클래스) 황제낙엽 2010.03.14 687
» 파일을 읽어서 CRC 값을 연산하는 메서드 (java.util.zip.CRC32) 황제낙엽 2010.03.14 483
173 byte배열에 대한 CRC 를 계산하는 메서드 (java.util.zip.CRC32) 황제낙엽 2010.03.14 2473
172 java의 List와 반복문(loop), 그리고 변수 선언 위치에 대해서 황제낙엽 2010.02.17 536
171 메모리 유출과 약한 참조 황제낙엽 2010.01.26 917
170 Methods of the Matcher Class 황제낙엽 2010.01.19 458
169 Pattern.matches() , Matcher.matches() , Matcher.find() file 황제낙엽 2010.01.19 619
168 java.lang.IllegalArgumentException 황제낙엽 2010.01.18 136737
167 org.apache.commons.fileupload.servlet.ServletFileUpload 를 이용한 파일 업로드 file 황제낙엽 2009.11.19 486
166 Error reading tld listeners java.lang.NullPointerException 황제낙엽 2009.10.14 462
165 Cannot find the tag library descriptor for “http://java.sun.com/jsp/jstl/core 황제낙엽 2009.10.14 1275
164 Transfer-Encoding: chunked VS Content-Length 황제낙엽 2009.09.17 531