AbsaOSS / AbsaOSS/cobrix

Get checksum actual record bytes

Đang mở
#749 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Scala
Star
170
Fork
96
Merge trung bình
57 phút
Pull request đã merge (30 ngày)
2

Mô tả

## Background
We have requirement like to validate upstream given checksum vs actual data checksum.

Currently we are stripping BDW and RDW and writing to file and calculating checksum.

## Feature

```Scala
def getDataBytes(infile:String,outfile:String) :String ={
val inputStream =new FileInputStream(new File(infile))
val outStream =new FileOutputStream(new File(outfile))
while (inputStream.available() > 0){
val bdw = BigInt(IOUtils.toByteArray(inputStream,2))
val bdwBuffer = Array.OfDim[Byte](bdw.toInt-2)
IOUtils.read(inputSream,bdwBuffer)
val block :Array[Byte] = bdwBuffer.drop(2)
var rdw =0
while (rdw < bdw -4) {
val rdwSize = BigInt(block.slice(rdw,rdw+2)).toInt
val record =block.slice(rdw+4, rdw+rdwSize)
outStream.write(record)
rdw = rdw + rdwSize
}
}
inputStream.close()
outStream.close()
}
```

Shell we avoid creating temp file and calculate directly record bytes hash (Md5 or Sha256) value ?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.