private void readColumnStarts(InputBuffer in) throws IOException { for (int i = 0; i < columnCount; i++) columns[i].start = in.readFixed64(); }
public double readDouble() throws IOException { return Double.longBitsToDouble(readFixed64()); }
public <T extends Comparable> T readValue(ValueType type) throws IOException { switch (type) { case NULL: return (T)null; case BOOLEAN: return (T)Boolean.valueOf(readBoolean()); case INT: return (T)Integer.valueOf(readInt()); case LONG: return (T)Long.valueOf(readLong()); case FIXED32: return (T)Integer.valueOf(readFixed32()); case FIXED64: return (T)Long.valueOf(readFixed64()); case FLOAT: return (T)Float.valueOf(readFloat()); case DOUBLE: return (T)Double.valueOf(readDouble()); case STRING: return (T)readString(); case BYTES: return (T)readBytes(null); default: throw new TrevniRuntimeException("Unknown value type: "+type); } }
private void readHeader() throws IOException { InputBuffer in = new InputBuffer(file, 0); readMagic(in); this.rowCount = in.readFixed64(); this.columnCount = in.readFixed32(); this.metaData = ColumnFileMetaData.read(in); this.columnsByName = new HashMap<>(columnCount); columns = new ColumnDescriptor[columnCount]; readColumnMetaData(in); readColumnStarts(in); }
@Test public void testFixed64() throws Exception { Random random = TestUtil.createRandom(); OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeFixed64(random.nextLong()); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) Assert.assertEquals(random.nextLong(), in.readFixed64()); }
private void readColumnStarts(InputBuffer in) throws IOException { for (int i = 0; i < columnCount; i++) columns[i].start = in.readFixed64(); }
public double readDouble() throws IOException { return Double.longBitsToDouble(readFixed64()); }
public <T extends Comparable> T readValue(ValueType type) throws IOException { switch (type) { case NULL: return (T)null; case INT: return (T)Integer.valueOf(readInt()); case LONG: return (T)Long.valueOf(readLong()); case FIXED32: return (T)Integer.valueOf(readFixed32()); case FIXED64: return (T)Long.valueOf(readFixed64()); case FLOAT: return (T)Float.valueOf(readFloat()); case DOUBLE: return (T)Double.valueOf(readDouble()); case STRING: return (T)readString(); case BYTES: return (T)readBytes(null); default: throw new TrevniRuntimeException("Unknown value type: "+type); } }
private void readHeader() throws IOException { InputBuffer in = new InputBuffer(file, 0); readMagic(in); this.rowCount = in.readFixed64(); this.columnCount = in.readFixed32(); this.metaData = ColumnFileMetaData.read(in); this.columnsByName = new HashMap<String,ColumnDescriptor>(columnCount); columns = new ColumnDescriptor[columnCount]; readColumnMetaData(in); readColumnStarts(in); }
@Test public void testFixed64() throws Exception { Random random = TestUtil.createRandom(); OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeFixed64(random.nextLong()); InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) Assert.assertEquals(random.nextLong(), in.readFixed64()); }