use of com.sap.hadoop.ds.streams.Streams.ByteArrayIS in project SQLWindowing by hbutani.
the class ByteBasedSortedMap method getEntry.
public void getEntry(int i, WritableEntry entry) throws BaseException {
LockUtils.lock(lock.readLock());
try {
i = index(i);
DataIStream dis = Streams.dis.get();
ByteArrayIS bis = dis.getUnderlyingStream();
bis.setBuffer(bytes, keyOffsetsArray[i], keyOffsetsArray[i + 1]);
entry.key.readFields(dis);
bis.setBuffer(bytes, valueOffsetsArray[i], valueOffsetsArray[i + 1]);
entry.value.readFields(dis);
} catch (IOException ie) {
throw new BaseException(ie);
} finally {
lock.readLock().unlock();
}
}
use of com.sap.hadoop.ds.streams.Streams.ByteArrayIS in project SQLWindowing by hbutani.
the class ByteBasedSortedMap method getValue.
public int getValue(Writable key, Writable value) throws BaseException {
LockUtils.lock(lock.readLock());
try {
int pos = getIndex(key) - startOffset;
if (pos != -1) {
int i = pos * 2;
DataIStream dis = Streams.dis.get();
ByteArrayIS bis = dis.getUnderlyingStream();
bis.setBuffer(bytes, valueOffsetsArray[i], valueOffsetsArray[i + 1]);
value.readFields(dis);
}
return pos;
} catch (IOException ie) {
throw new BaseException(ie);
} finally {
lock.readLock().unlock();
}
}
use of com.sap.hadoop.ds.streams.Streams.ByteArrayIS in project SQLWindowing by hbutani.
the class ByteBasedSortedMap method getKey.
public void getKey(int i, Writable wObj) throws BaseException {
LockUtils.lock(lock.readLock());
try {
i = index(i);
DataIStream dis = Streams.dis.get();
ByteArrayIS bis = dis.getUnderlyingStream();
bis.setBuffer(bytes, keyOffsetsArray[i], keyOffsetsArray[i + 1]);
wObj.readFields(dis);
} catch (IOException ie) {
throw new BaseException(ie);
} finally {
lock.readLock().unlock();
}
}
use of com.sap.hadoop.ds.streams.Streams.ByteArrayIS in project SQLWindowing by hbutani.
the class ByteBasedList method get.
public void get(int i, Writable wObj) throws BaseException {
LockUtils.lock(lock.readLock());
try {
i = index(i);
DataIStream dis = Streams.dis.get();
ByteArrayIS bis = dis.getUnderlyingStream();
bis.setBuffer(bytes, offsetsArray[i], offsetsArray[i + 1]);
wObj.readFields(dis);
} catch (IOException ie) {
throw new BaseException(ie);
} finally {
lock.readLock().unlock();
}
}
Aggregations