Alachisoft.NCache.Common.Activate.CpuInfoResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-common Show documentation
Show all versions of nc-common Show documentation
Internal package of Alachisoft.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Alachisoft.NCache.Common.Activate;
import Alachisoft.NCache.Common.Common;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;
import java.io.IOException;
/**
* @author Muneeb_Shahid
*/
public class CpuInfoResult implements InternalCompactSerializable {
private byte[][] infoChunks;
public CpuInfoResult() {
}
public CpuInfoResult(byte[][] dataChunks) {
this.infoChunks = dataChunks;
}
@Override
public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
int totalChunks = Common.as(reader.ReadObject(), Integer.class);
infoChunks = new byte[totalChunks][totalChunks];
int chunkNo = 0;
while (chunkNo < totalChunks) {
int length = Common.as(reader.ReadObject(), Integer.class);
byte[] temp = reader.ReadBytes(length);
infoChunks[chunkNo++] = temp;
}
}
@Override
public void Serialize(CompactWriter writer) throws IOException {
writer.WriteObject(infoChunks.length);
for (byte[] infoChunk : infoChunks) {
writer.WriteObject(infoChunk.length);
writer.Write(infoChunk);
}
}
}