@Test public void test() throws Exception { float value = 7.101f; Encoder encoder = new FloatEncoder(TSEncoding.RLE, TSDataType.FLOAT, 3); ByteArrayOutputStream baos = new ByteArrayOutputStream(); encoder.encode(value, baos); encoder.flush(baos); encoder.encode(value + 2, baos); encoder.flush(baos); ByteBuffer buffer = ByteBuffer.wrap(baos.toByteArray()); Decoder decoder1 = new FloatDecoder(TSEncoding.RLE, TSDataType.FLOAT); Decoder decoder2 = new FloatDecoder(TSEncoding.RLE, TSDataType.FLOAT); float value1_ = decoder1.readFloat(buffer); float value2_ = decoder2.readFloat(buffer); assertEquals(value, value1_, delta); assertEquals(value + 2, value2_, delta); LOGGER.debug("{} LOGGER.debug("{} }
@Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; }
FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } }
FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); }
FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); @Override float readFloat(ByteBuffer buffer); @Override double readDouble(ByteBuffer buffer); @Override boolean hasNext(ByteBuffer buffer); @Override Binary readBinary(ByteBuffer buffer); @Override boolean readBoolean(ByteBuffer buffer); @Override short readShort(ByteBuffer buffer); @Override int readInt(ByteBuffer buffer); @Override long readLong(ByteBuffer buffer); @Override void reset(); }
FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); @Override float readFloat(ByteBuffer buffer); @Override double readDouble(ByteBuffer buffer); @Override boolean hasNext(ByteBuffer buffer); @Override Binary readBinary(ByteBuffer buffer); @Override boolean readBoolean(ByteBuffer buffer); @Override short readShort(ByteBuffer buffer); @Override int readInt(ByteBuffer buffer); @Override long readLong(ByteBuffer buffer); @Override void reset();  }