1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16export class TransferPayload extends Object{ 17 private _index: number; // uint64_t 18 private _compressType: number; // uint8_t; 19 private _compressSize: number; // uint32_t 20 private _uncompressSize: number; //uint32_t 21 22 constructor(index: number, compressType: number, compressSize: number, uncompressSize: number) { 23 super(); 24 this._index = index; 25 this._compressType = compressType; 26 this._compressSize = compressSize; 27 this._uncompressSize = uncompressSize; 28 } 29 30 31 getDataView(): DataView { 32 const view = new DataView(new ArrayBuffer(24)); 33 return view; 34 } 35 36 get index(): number { 37 return this._index; 38 } 39 40 set index(value: number) { 41 this._index = value; 42 } 43 44 get compressType(): number { 45 return this._compressType; 46 } 47 48 set compressType(value: number) { 49 this._compressType = value; 50 } 51 52 get compressSize(): number { 53 return this._compressSize; 54 } 55 56 set compressSize(value: number) { 57 this._compressSize = value; 58 } 59 60 get uncompressSize(): number { 61 return this._uncompressSize; 62 } 63 64 set uncompressSize(value: number) { 65 this._uncompressSize = value; 66 } 67 68 toString(): string { 69 return "index: " + this._index 70 + " compressType: " + this._compressType 71 + " compressSize: " + this._compressSize 72 + " uncompressSize: " + this._uncompressSize; 73 } 74} 75