Package java.util.zip

Examples of java.util.zip.CRC32


    disposed += free(filter("free=false and expires > 0 and (expires) <= " + System.currentTimeMillis() + " limit 1, 100" + limit));
    return disposed;
  }
 
  public static long crc32(byte[] payload) {
    final Checksum checksum = new CRC32();
    checksum.update(payload,0,payload.length);
    return checksum.getValue();
  }
View Full Code Here


    String rtn = CACHE_BUFFER.get(kkk);
    if (rtn == null) {
      StringBuffer buff=new StringBuffer();
      buff.append(this.getClass().getName()).append("_");
      buff.append(this.dir_uuid).append("_");
    CRC32 crc32 = new CRC32();
    crc32.update(0);
    long filesize=0;
      if(filelist!=null)
      {
        buff.append(filelist.length).append("_");
        for(String s:filelist)
        {
            crc32.update(new String(s).getBytes());
            try{
              filesize+=this.fileLength(s);
            }catch(Throwable e)
            {
              logger.error("filelength",e);
            }
        }
      }
    long crcvalue = crc32.getValue();
    buff.append(crcvalue).append("_");
    buff.append(filesize).append("_");
    rtn = buff.toString();
    CACHE_BUFFER.put(kkk, rtn);
View Full Code Here

    String rtn = CACHE_BUFFER.get(kkk);
    if (rtn == null) {
    StringBuffer buff = new StringBuffer();
    buff.append(this.getClass().getName()).append("_");
    buff.append(this.directory.getAbsolutePath()).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());
        try {
          filesize += this.fileLength(s);
        } catch (Throwable e) {
          logger.error("filelength", e);
        }

        try {
          filemodify = Math.max(filemodify, this.fileModified(s));
        } catch (Throwable e) {
          logger.error("filelength", e);
        }
      }
    }
    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

    }else if (dataType == FieldDatatype.d_double) {
     
      Double val=MdrillUtils.ParseDouble(ft.indexedToReadable(term.text()));
      tmValue=Double.doubleToLongBits(val);
    }else{
      CRC32 crc32 = new CRC32();
      crc32.update(new String(ft.indexedToReadable(term.text())).getBytes());
      tmValue=crc32.getValue();
    }
     

      docValues.collectTm(tmValue);
      if ((this.termNum & TermIndex.intervalMask)==0){
View Full Code Here

String filename;


public ChecksumIndexOutput(IndexOutput main,Directory directory,String filename) {
    this.main = main;
    digest = new CRC32();
    this.directory=directory;
    this.filename=filename;

  }
View Full Code Here

public class CRC32OutputStream extends OutputStream {
    private CRC32 hasher;
   
    public CRC32OutputStream() {
        hasher = new CRC32();
    }
View Full Code Here

import java.util.zip.CRC32;

public class MdrillFunction {
  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 ShardScanner getShardScanner(short shard,String partion, byte[] last) throws IOException {
    CRC32 crc32 = new CRC32();
    crc32.update(partion.getBytes());
    return new ShardScanner(table.getConfiguration(), queueName, shard, crc32.getValue(),last);
  }
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

  private byte[] value;
  private MessageID id;

  public static Message INSTANCE(short shard,String partion,byte[] value,Configuration realConf)
  {
    CRC32 crc32 = new CRC32();
    crc32.update(partion.getBytes());
    MessageID id=MessageID.INSTANCE(shard, crc32.getValue(), realConf);
    return new Message( id, value);
  }
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.