@Override public ReadBuffer asReadBuffer() { return new ReadArrayBuffer(this); }
@Override public boolean getBoolean() { return getBoolean(updatePos(1)); }
@Override public Geoshape read(ScanBuffer buffer) { long l = VariableLong.readPositive(buffer); assert l>0 && l<Integer.MAX_VALUE; int length = (int)l; int position = ((ReadArrayBuffer) buffer).getPosition(); InputStream inputStream = new ByteArrayInputStream(buffer.getBytes(length)); try { return GeoshapeBinarySerializer.read(inputStream); } catch (IOException e) { // retry using legacy point deserialization try { ((ReadArrayBuffer) buffer).movePositionTo(position); final float lat = buffer.getFloat(); final float lon = buffer.getFloat(); return point(lat, lon); } catch (Exception ignored) { } // throw original exception throw new RuntimeException("I/O exception reading geoshape", e); } }
@Override public <T> T getColumnAs(Factory<T> factory) { return super.as(factory,0,currentValuePos); }
@Test @Category({UnorderedKeyStoreTests.class}) public void testGetKeysWithSliceQuery() throws Exception { if (!manager.getFeatures().hasUnorderedScan()) { log.warn("Can't test key-unordered features on incompatible store. " + "This warning could indicate reduced test coverage and " + "a broken JUnit configuration. Skipping test {}.", name.getMethodName()); return; } populateDBWith100Keys(); tx.commit(); tx = startTx(); KeyIterator keyIterator = store.getKeys( new SliceQuery(new ReadArrayBuffer("b".getBytes()), new ReadArrayBuffer("c".getBytes())), tx); examineGetKeysResults(keyIterator, 0, 100); }
@Test @Category({OrderedKeyStoreTests.class}) public void testGetKeysWithKeyRange() throws Exception { if (!manager.getFeatures().hasOrderedScan()) { log.warn("Can't test ordered scans on incompatible store. " + "This warning could indicate reduced test coverage and " + "shouldn't happen in an ideal JUnit configuration. " + "Skipping test {}.", name.getMethodName()); return; } populateDBWith100Keys(); tx.commit(); tx = startTx(); KeyIterator keyIterator = store.getKeys(new KeyRangeQuery( KeyColumnValueStoreUtil.longToByteBuffer(10), // key start KeyColumnValueStoreUtil.longToByteBuffer(40), // key end new ReadArrayBuffer("b".getBytes()), // column start new ReadArrayBuffer("c".getBytes())), tx); examineGetKeysResults(keyIterator, 10, 40); }