Package org.apache.hadoop.util

Examples of org.apache.hadoop.util.DataChecksum.update()


    }

    // compute data CRC
    DataChecksum checksum = DataChecksum.newDataChecksum(
        DataChecksum.CHECKSUM_CRC32, 1);
    checksum.update(data, 0, data.length);

    // compute checksum
    final int crc = fs.getFileCrc(foo);
    System.out.println("crc=" + crc);
View Full Code Here


         
        }
        // compute data CRC
        DataChecksum checksum = DataChecksum.newDataChecksum(
            DataChecksum.CHECKSUM_CRC32, 1);
        checksum.update(data, 0, data.length);
       
        //compute checksum
        final int crc = hdfs.getFileCrc(foo);
        System.out.println("crc=" + crc);
       
View Full Code Here

      while (true) {
        int bytesRead = streamIn.read(buf);
        if (bytesRead == -1) {
          break;
        } else
          checksum.update(buf, 0, bytesRead);
      }
      return (int) checksum.getValue();
    } finally {
      IOUtils.closeStream(streamIn);
    }
View Full Code Here

    } finally {
      ra.close();
    }

    // compute checksum
    dcs.update(b, 0, lastchunksize);
    dcs.writeValue(b, 0, false);

    // update metaFile
    RandomAccessFile metaRAF = new RandomAccessFile(metafile, "rw");
    try {
View Full Code Here

        // read last chunk
        ra.seek(lastchunkoffset);
        ra.readFully(b, 0, lastchunksize);

        // compute checksum
        dcs.update(b, 0, lastchunksize);
        dcs.writeValue(b, 0, false);

        ra.seek(newBlockFileSize - checksumSize);
        ra.write(b, 0, checksumSize);
      }
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.