Package java.util.zip

Examples of java.util.zip.CRC32


import java.util.zip.CRC32;

public class SpoutUtils {
  public static Long uuid()
  {
    CRC32 crc32 = new CRC32();
    crc32.update(String.valueOf(java.util.UUID.randomUUID().toString()).getBytes());
    return crc32.getValue();
  }
View Full Code Here


  }
 
 
  public long getkeyCrc()
  {
    CRC32 crc32 = new CRC32();
    crc32.update(String.valueOf(this.key).getBytes());
    return crc32.getValue();
  }
View Full Code Here

     * @param len The length of the encoded filename or commentin
     * <code>bytes</code>.
     */
    protected AbstractUnicodeExtraField(String text, byte[] bytes, int off,
                                        int len) {
        CRC32 crc32 = new CRC32();
        crc32.update(bytes, off, len);
        nameCRC32 = crc32.getValue();

        try {
            unicodeName = text.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("FATAL: UTF-8 encoding not supported.",
View Full Code Here

public class LuceneUtils  {
 
  public static String crcKey(IndexReader r)
  {
    String key= r.getStringCacheKey();
    CRC32 crc32 = new CRC32();
    crc32.update(new String(key).getBytes());
    long crcvalue = crc32.getValue();
   
    StringBuffer buff=new StringBuffer();
    buff.append(abs(key.hashCode()));
    buff.append("_");
    buff.append(abs(crcvalue));
View Full Code Here

   
    if(rtn.size()<=0)
    {
      return 0;
    }
    CRC32 crc32 = new CRC32();
    crc32.update(java.util.UUID.randomUUID().toString().getBytes());
    rtn.put("higo_uuid", Long.toString(crc32.getValue()));
    list.add(rtn);
    return 1;
  }
View Full Code Here

  }
 
  public void setCrcRecord(String newparentGroup)
  {
    int len = newparentGroup.length();
    CRC32 crc32 = new CRC32();
    crc32.update(new String(newparentGroup).getBytes());
    int crcvalue = (int) crc32.getValue();
    int hashCode = newparentGroup.hashCode();
   
    ArrayList<Integer> key=new ArrayList<Integer>(3);
    key.add(crcvalue);
    key.add(len);
View Full Code Here

    @Override
    public Object clone() {
        try {
            AsiExtraField cloned = (AsiExtraField) super.clone();
            cloned.crc = new CRC32();
            return cloned;
        } catch (CloneNotSupportedException cnfe) {
            // impossible
            throw new RuntimeException(cnfe);
        }
View Full Code Here

    public String sortString;
  }
 
  private long getkeyCrc()
  {
    CRC32 crc32 = new CRC32();
    crc32.update(String.valueOf(hostId+"@"+this.segKey).getBytes());
    return crc32.getValue();
  }
View Full Code Here

  }
 

  private long getkeyCrc()
  {
    CRC32 crc32 = new CRC32();
    crc32.update(String.valueOf(hostId+"@"+this.segKey).getBytes());
    return crc32.getValue();
  }
View Full Code Here

    if (this.uni.fieldDataType == FieldDatatype.d_long) {
      this.uni.setTmValueLong(termNum,Long.parseLong(this.uni.ft.indexedToReadable(t.text()))) ;
    } else if (this.uni.fieldDataType == FieldDatatype.d_double) {
      this.uni.setTmValueDouble(termNum, MdrillUtils.ParseDouble(this.uni.ft.indexedToReadable(t.text())));
    } else if (this.uni.fieldDataType == FieldDatatype.d_string) {// for dist
      CRC32 crc32 = new CRC32();
      crc32.update(new String(this.uni.ft.indexedToReadable(t.text())).getBytes());
      this.uni.setTmValueLong(termNum, crc32.getValue());
    }
  }
View Full Code Here

TOP

Related Classes of java.util.zip.CRC32

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.