Package java.util.zip

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


  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

    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

    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

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

     * @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

  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

            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


 
    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

     */
    private static
        String getUnicodeStringIfOriginalMatches(AbstractUnicodeExtraField f,
                                                 byte[] orig) {
        if (f != null) {
            CRC32 crc32 = new CRC32();
            crc32.update(orig);
            long origCRC32 = crc32.getValue();

            if (origCRC32 == f.getNameCRC32()) {
                try {
                    return ZipEncodingHelper
                        .UTF8_ZIP_ENCODING.decode(f.getUnicodeName());
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.