Package java.util.zip

Examples of java.util.zip.CRC32


    return false;
  }

  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 void startSyncFromHdfs(final Runnable callback) throws IOException
  {
      Configuration conf=params.getConf();
     
      CRC32 crc32 = new CRC32();
    crc32.update(String.valueOf(java.util.UUID.randomUUID().toString()).getBytes());
    Long uuid=crc32.getValue();
    String pathname=String.valueOf(fmt.format(new Date())+"_"+status.uniqIndex.incrementAndGet()) + "_"  + uuid;
     
      final Path localHdfsRecover=new Path(new Path(params.getIndexMalloc(pathname.hashCode()),"realtime_hdfs_recover"),pathname);
      final Path hdfsRealtime=new Path(params.hdfsPath,"realtime");
     
View Full Code Here

    return false;
  }

  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 static SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss");

  private String mallocPath() {
    while (true) {
     
      CRC32 crc32 = new CRC32();
      crc32.update(String.valueOf(java.util.UUID.randomUUID().toString()).getBytes());
      Long uuid=crc32.getValue();
      String pathname=String.valueOf(fmt.format(new Date())+"_"+status.uniqIndex.incrementAndGet()) + "_"  + uuid;
      File rtn = new File(new File(params.getIndexMalloc(pathname.hashCode()), "realtime"),pathname);
      if (rtn.exists()) {
        continue;
      }
View Full Code Here

  public DistinctCount() {

  }

  public void set(String item) {
    CRC32 crc32 = new CRC32();
    crc32.update(new String(item).getBytes());
    long crcvalue = crc32.getValue();
    this.add((int) crcvalue);
  }
View Full Code Here

    long crcvalue = crc32.getValue();
    this.add((int) crcvalue);
  }
 
  public void set(double item) {
    CRC32 crc32 = new CRC32();
    crc32.update(ByteUtil.getBytes(item));
    long crcvalue = crc32.getValue();
    this.add((int) crcvalue);
  }
View Full Code Here

    long crcvalue = crc32.getValue();
    this.add((int) crcvalue);
  }
 
  public void set(int item) {
    CRC32 crc32 = new CRC32();
    crc32.update(ByteUtil.getBytes(item));
    long crcvalue = crc32.getValue();
    this.add((int) crcvalue);
  }
View Full Code Here

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

      StringBuffer buff = new StringBuffer();
      buff.append(this.getClass().getName()).append("_");
      buff.append(this.directory.toString()).append("_");

      CRC32 crc32 = new CRC32();
      crc32.update(0);
      long filesize = 0;
      long filemodify = 0;

      if (filelist != null) {
        buff.append(filelist.length).append("_");
        for (String s : filelist) {
          crc32.update(new String(s).getBytes());
          FileStatus fstatus=null;
          try {
            fstatus=this.fileStatus(s) ;
          } catch (Throwable e) {
            fstatus=null;
            logger.error("fileStatus", e);
          }
          if(fstatus!=null)
          {
            filesize += fstatus.getLen();
            filemodify = Math.max(filemodify, fstatus.getModificationTime());
          }

       
        }
      }
      long crcvalue = crc32.getValue();
      buff.append(crcvalue).append("_");
      buff.append(filesize).append("_");
      buff.append(filemodify).append("_");
      buff.append(format.format(new Date(filemodify)));
      rtn = buff.toString();
View Full Code Here

  public static SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss");

  private String mallocPath() {
    while (true) {
     
      CRC32 crc32 = new CRC32();
      crc32.update(String.valueOf(java.util.UUID.randomUUID().toString()).getBytes());
      Long uuid=crc32.getValue();
      String pathname=String.valueOf(fmt.format(new Date())+"_"+status.uniqIndex.incrementAndGet()) + "_"  + uuid;
      File rtn = new File(new File(params.getIndexMalloc(pathname.hashCode()), "realtime"),pathname);
      if (rtn.exists()) {
        continue;
      }
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.