com.xxdb.data.BasicStringVector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-java Show documentation
Show all versions of api-java Show documentation
The messaging and data conversion protocol between Java and DolphinDB server
package com.xxdb.data;
import java.io.IOException;
import java.util.List;
import com.xxdb.io.ExtendedDataInput;
import com.xxdb.io.ExtendedDataOutput;
/**
*
* Corresponds to DolphinDB string vector
*
*/
public class BasicStringVector extends AbstractVector{
private String[] values;
private boolean isSymbol;
private boolean isBlob = false;
public BasicStringVector(int size){
this(DATA_FORM.DF_VECTOR, size, false);
}
public BasicStringVector(List list){
super(DATA_FORM.DF_VECTOR);
if (list != null) {
values = new String[list.size()];
for (int i=0; i list, boolean blob){
super(DATA_FORM.DF_VECTOR);
if (list != null) {
values = new String[list.size()];
for (int i=0; i getElementClass(){
return BasicString.class;
}
@Override
public int rows() {
return values.length;
}
protected void writeVectorToOutputStream(ExtendedDataOutput out) throws IOException{
if(!isBlob) {
for (String str : values)
out.writeString(str);
} else {
for (String str : values)
out.writeBlob(str);
}
}
}