public BasicArrayVector(DATA_TYPE type, ExtendedDataInput @in) : base(DATA_FORM.DF_VECTOR) { this.type = type; int rows = @in.readInt(); int cols = @in.readInt(); rowIndices = new List <int>(new int[rows]); DATA_TYPE valueType = type - 64; valueVec = (AbstractVector)BasicEntityFactory.instance().createVectorWithDefaultValue(valueType, cols); this.baseUnitLength_ = valueVec.getUnitLength(); int rowsRead = 0; int rowsReadInBlock = 0; int prevIndex = 0; int totalBytes = 0; while (rowsRead < rows) { //read block header int blockRows = @in.readShort(); int countBytes = @in.readChar(); @in.skipBytes(1); //read array of count totalBytes = blockRows * countBytes; rowsReadInBlock = 0; int offect = 0; while (offect < totalBytes) { int len = Math.Min(BUF_SIZE, totalBytes - offect); @in.readFully(buf, 0, len); int curRows = len / countBytes; if (countBytes == 1) { for (int i = 0; i < curRows; i++) { int curRowCells = buf[i]; rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } else if (countBytes == 2) { for (int i = 0; i < curRows; ++i) { int curRowCells = BitConverter.ToInt16(buf, i * 2); rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } else { for (int i = 0; i < curRows; ++i) { int curRowCells = BitConverter.ToInt32(buf, i * 4); rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } rowsReadInBlock += curRows; offect += len; } //read array of values int rowStart = rowsRead == 0 ? 0 : rowIndices[rowsRead - 1]; int valueCount = rowIndices[rowsRead + rowsReadInBlock - 1] - rowStart; valueVec.deserialize(rowStart, valueCount, @in); rowsRead += rowsReadInBlock; } }