/** Seek to the named row. */ public void seek(long r) throws IOException { if (r < row || r >= column.lastRow(block)) // not in current block startBlock(column.findBlock(r)); // seek to block start while (r > row && hasNext()) { // skip within block values.skipValue(type); row++; } previous = null; }
@Test public void testSkipBytes() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue("trevni".getBytes(), ValueType.BYTES); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.BYTES); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testInitPos() throws Exception {
@Test public void testSkipInt() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Integer.MAX_VALUE, ValueType.INT); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.INT); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipLong() throws Exception {
@Test public void testSkipFloat() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Float.MAX_VALUE, ValueType.FLOAT); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.FLOAT); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipDouble() throws Exception {
@Test public void testSkipLong() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.LONG); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipFixed32() throws Exception {
@Test public void testSkipFixed64() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.FIXED64); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipFloat() throws Exception {
@Test public void testSkipNull() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(null, ValueType.NULL); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.NULL); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipBoolean() throws Exception {
@Test public void testSkipFixed32() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Integer.MAX_VALUE, ValueType.FIXED32); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipFixed64() throws Exception {
@Test public void testSkipString() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue("trevni", ValueType.STRING); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.STRING); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipBytes() throws Exception {
@Test public void testSkipBoolean() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(false, ValueType.BOOLEAN); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.BOOLEAN); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipInt() throws Exception {
@Test public void testSkipDouble() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Double.MAX_VALUE, ValueType.DOUBLE); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.DOUBLE); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipString() throws Exception {
/** Seek to the named row. */ public void seek(long r) throws IOException { if (r < row || r >= column.lastRow(block)) // not in current block startBlock(column.findBlock(r)); // seek to block start while (r > row && hasNext()) { // skip within block values.skipValue(type); row++; } previous = null; }
@Test public void testSkipBytes() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue("trevni".getBytes(), ValueType.BYTES); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.BYTES); Assert.assertEquals(sentinel, in.readLong()); } }
@Test public void testSkipNull() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(null, ValueType.NULL); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.NULL); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipInt() throws Exception {
@Test public void testSkipFloat() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Float.MAX_VALUE, ValueType.FLOAT); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.FLOAT); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipDouble() throws Exception {
@Test public void testSkipDouble() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Double.MAX_VALUE, ValueType.DOUBLE); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.DOUBLE); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipString() throws Exception {
@Test public void testSkipInt() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Integer.MAX_VALUE, ValueType.INT); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.INT); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipLong() throws Exception {
@Test public void testSkipLong() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.LONG); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipFixed32() throws Exception {
@Test public void testSkipFixed64() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.FIXED64); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipFloat() throws Exception {
@Test public void testSkipString() throws Exception { long sentinel = Long.MAX_VALUE; OutputBuffer out = new OutputBuffer(); out.writeValue("trevni", ValueType.STRING); out.writeLong(sentinel); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.STRING); Assert.assertEquals(sentinel, in.readLong()); } @Test public void testSkipBytes() throws Exception {