/[Apache-SVN]/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/JenkinsHash.java
ViewVC logotype

Diff of /hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/JenkinsHash.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 618357, Mon Feb 4 18:14:02 2008 UTC revision 639775, Fri Mar 21 19:46:34 2008 UTC
# Line 20  Line 20 
20    
21  package org.apache.hadoop.hbase.util;  package org.apache.hadoop.hbase.util;
22    
23    import java.io.FileInputStream;
24    import java.io.IOException;
25    
26  /**  /**
27   * lookup3.c, by Bob Jenkins, May 2006, Public Domain.   * lookup3.c, by Bob Jenkins, May 2006, Public Domain.
28   * <a href="http://burtleburtle.net/bob/c/lookup3.c">lookup3.c</a>   * <a href="http://burtleburtle.net/bob/c/lookup3.c">lookup3.c</a>
# Line 231  public class JenkinsHash { Line 234  public class JenkinsHash {
234    
235      return Long.valueOf(c & INT_MASK).intValue();      return Long.valueOf(c & INT_MASK).intValue();
236    }    }
237    
238      /**
239       * Compute the hash of the specified file
240       * @param args name of file to compute hash of.
241       * @throws IOException
242       */
243      public static void main(String[] args) throws IOException {
244        if (args.length != 1) {
245          System.err.println("Usage: JenkinsHash filename");
246          System.exit(-1);
247        }
248        FileInputStream in = new FileInputStream(args[0]);
249        byte[] bytes = new byte[512];
250        int value = 0;
251        for (int length = in.read(bytes); length > 0 ; length = in.read(bytes)) {
252          value = hash(bytes, length, value);
253        }
254        System.out.println(Math.abs(value));
255      }
256  }  }

Legend:
Removed from v.618357  
changed lines
  Added in v.639775

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2