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 534
182 RMI 시작하기(2) file 황제낙엽 2010.05.27 499
181 RMI 시작하기(1) file 황제낙엽 2010.05.27 448
180 Java Remote Method Invocation (Java RMI) 황제낙엽 2010.05.27 439
179 javax.script API 관련 스크랩 (ScriptEngine, ScriptEngineManager) 황제낙엽 2010.05.25 459
178 java.util.Properties 파일 사용 예제 file 황제낙엽 2010.04.06 438
177 10진수 <-> 16진수(Hex) 변환 file 황제낙엽 2010.03.29 1539
176 ServletConfig 이용하기 황제낙엽 2010.03.15 455
175 16비트 CRC 체크용 클래스 (사용자 클래스) 황제낙엽 2010.03.14 646
» 파일을 읽어서 CRC 값을 연산하는 메서드 (java.util.zip.CRC32) 황제낙엽 2010.03.14 449
173 byte배열에 대한 CRC 를 계산하는 메서드 (java.util.zip.CRC32) 황제낙엽 2010.03.14 2445
172 java의 List와 반복문(loop), 그리고 변수 선언 위치에 대해서 황제낙엽 2010.02.17 504
171 메모리 유출과 약한 참조 황제낙엽 2010.01.26 907
170 Methods of the Matcher Class 황제낙엽 2010.01.19 431
169 Pattern.matches() , Matcher.matches() , Matcher.find() file 황제낙엽 2010.01.19 595
168 java.lang.IllegalArgumentException 황제낙엽 2010.01.18 136071
167 org.apache.commons.fileupload.servlet.ServletFileUpload 를 이용한 파일 업로드 file 황제낙엽 2009.11.19 464
166 Error reading tld listeners java.lang.NullPointerException 황제낙엽 2009.10.14 432
165 Cannot find the tag library descriptor for “http://java.sun.com/jsp/jstl/core 황제낙엽 2009.10.14 1246
164 Transfer-Encoding: chunked VS Content-Length 황제낙엽 2009.09.17 505