Examples of CRC32


Examples of java.util.zip.CRC32

    switch (randomInt(2)) {
    case 0:
      checksum = new Adler32();
      break;
    case 1:
      checksum = new CRC32();
      break;
    default:
      checksum = XXHashFactory.fastestInstance().newStreamingHash32(randomInt()).asChecksum();
      break;
    }
View Full Code Here

Examples of java.util.zip.CRC32

    System.arraycopy(data, byteOffset(), res, 0, octets);
    return res;
  }

  public long crc() {
    CRC32 crc = new CRC32();

    int octets = byteSize();
    crc.update(data, byteOffset(), octets);
    return crc.getValue();
  }
View Full Code Here

Examples of java.util.zip.CRC32

  private static long crcFile(File file) throws IOException {

    CheckedInputStream cis = null;
    long fileSize = 0;
    cis = new CheckedInputStream(new FileInputStream(file), new CRC32());
    try {
      byte[] buf = new byte[4 * 1024];
      while (cis.read(buf) >= 0)
        ;

View Full Code Here

Examples of java.util.zip.CRC32

    return new EBinary(all);
  }

  @BIF
  static ENumber crc32(EObject io_list) {
    CRC32 crc = new CRC32();
    EIOListVisitor.update(io_list, crc);
    return ERT.box(crc.getValue());
  }
View Full Code Here

Examples of java.util.zip.CRC32

    if (((init=num.testInteger()) == null)
        || (val = init.longValue()) != (val & 0xffffffffL)) {
      throw ERT.badarg(num, io_list);
    }
   
    CRC32 crc = new CRC32();
    try {
      CRC32_crc.setInt(crc, (int)val);
    } catch (IllegalArgumentException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
    EIOListVisitor.update(io_list, crc);
    return ERT.box(crc.getValue());
  }
View Full Code Here

Examples of java.util.zip.CRC32

  private static String expected = "";
  private static String last;
 
  public CalcChecksum() {
    /* Initialize crc32 */
    crc = new CRC32();
  }
View Full Code Here

Examples of java.util.zip.CRC32

     * @throws IllegalArgumentException if the file is a directory
     * @throws IOException if an IO error occurs reading the file
     * @since 1.3
     */
    public static long checksumCRC32(final File file) throws IOException {
        final CRC32 crc = new CRC32();
        checksum(file, crc);
        return crc.getValue();
    }
View Full Code Here

Examples of java.util.zip.CRC32

  public boolean verifyCRC(long crc) {
    return (this.getCRC() == crc);
  }

  public long getCRC() {
    CRC32 crc32 = new CRC32();
    crc32.update(this.type);
    crc32.update(this.data);

    return crc32.getValue();
  }
View Full Code Here

Examples of java.util.zip.CRC32

            return ByteStreams.getChecksum(new InputSupplier<TFileInputStream>() {
                @Override
                public TFileInputStream getInput() throws IOException {
                    return new TFileInputStream(file);
                }
            }, new CRC32());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of java.util.zip.CRC32


 
    public static String getPath(String storePath,int taskIndex,int offset,FileSystem lfs)
    {
    CRC32 crc32 = new CRC32();
     crc32.update(String.valueOf(taskIndex).getBytes());
     long crcvalue = crc32.getValue();
     if(crcvalue<0)
      {
       crcvalue*=-1;
      }
  if(offset<0)
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.