com.scudata.dw.IndexFCursor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.dw;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import com.scudata.array.IArray;
import com.scudata.common.RQException;
import com.scudata.dm.DataStruct;
import com.scudata.dm.FileObject;
import com.scudata.dm.ObjectReader;
import com.scudata.dm.Record;
import com.scudata.dm.Sequence;
import com.scudata.dm.Table;
import com.scudata.dm.cursor.ICursor;
/**
* ????KV???????α?
* ????ȡȫ?????ݵ????
* @author runqian
*
*/
public class IndexFCursor extends ICursor {
private static final int BUFFER_SIZE = 1024;
private long recordCount;
private String []ifields;
private String []vfields;
private long startPos;
private boolean isClosed;
private Sequence cache;
private FileObject indexFile;
private ObjectReader reader;
private boolean isFirstSkip = true;
public IndexFCursor(TableKeyValueIndex index, long startPos) {
this.startPos = startPos;
ifields = index.ifields;
vfields = index.vfields;
indexFile = index.indexFile;
recordCount = index.srcTable.getActualRecordCount();
int icount = ifields.length;
int vcount = vfields.length;
String []fieldNames = Arrays.copyOf(ifields, icount + vcount);
System.arraycopy(vfields, 0, fieldNames, icount, vcount);
dataStruct = new DataStruct(fieldNames);
init();
}
void init() {
InputStream is = indexFile.getInputStream();
reader = new ObjectReader(is, BUFFER_SIZE);
try {
reader.seek(startPos);
} catch (IOException e) {
try {
reader.close();
} catch (IOException e1) {
}
throw new RQException(e.getMessage(), e);
}
}
private void getData(Sequence data, int n) {
int icount = ifields.length;
int vcount = vfields.length;
ArrayList
© 2015 - 2024 Weber Informatics LLC | Privacy Policy