com.xxdb.data.BasicChunkMeta Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dolphindb-javaapi Show documentation
Show all versions of dolphindb-javaapi Show documentation
The messaging and data conversion protocol between Java and DolphinDB server
package com.xxdb.data;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.xxdb.io.AbstractExtendedDataOutputStream;
import com.xxdb.io.ExtendedDataInput;
import com.xxdb.io.ExtendedDataOutput;
public class BasicChunkMeta extends AbstractEntity implements Entity{
private String path;
private BasicUuid id;
private int version;
private int size;
private byte flag;
private List sites;
public BasicChunkMeta(ExtendedDataInput in) throws IOException{
in.readShort(); //skip the length of the data
path = in.readString();
id = new BasicUuid(in);
version = in.readInt();
size = in.readInt();
flag = in.readByte();
sites = new ArrayList<>();
int copyCount = in.readByte();
for(int i=0; i0)
str.append(", ");
str.append(sites.get(i));
}
str.append("}, v");
str.append(version);
str.append(", ");
str.append(size);
if(isSplittable())
str.append(", splittable]");
else
str.append("]");
return str.toString();
}
@Override
public void write(ExtendedDataOutput output) throws IOException {
int length = 27 + AbstractExtendedDataOutputStream.getUTFlength(path, 0, 0) + sites.size();
for(String site : sites)
length += AbstractExtendedDataOutputStream.getUTFlength(site, 0, 0);
output.writeShort(length);
output.writeString(path);
output.writeLong2(id.getLong2());
output.writeInt(version);
output.writeInt(size);
output.writeByte(flag);
output.writeByte(sites.size());
for(String site : sites)
output.writeUTF(site);
}
}