@Override public void encodeValue( final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { int count = 0; if (value != null) { encoder.encodeRawInt((Integer) value, type); count++; } for (; count < minValues; count++) encoder.encodeRawMissingValue(type); }
@Override public void encodeValue( final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { int count = 0; for (final Integer i : BCF2Utils.toList(Integer.class, value)) { if (i != null) { // necessary because .,. => [null, null] in VC encoder.encodeRawInt(i, type); count++; } } for (; count < minValues; count++) encoder.encodeRawMissingValue(type); }
@Override public void encodeValue( final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { final String s = javaStringToBCF2String(value); encoder.encodeRawString(s, Math.max(s.length(), minValues)); }
@Override public void encodeValue( final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { int count = 0; // TODO -- can be restructured to avoid toList operation if (isAtomic) { // fast path for fields with 1 fixed float value if (value != null) { encoder.encodeRawFloat((Double) value); count++; } } else { // handle generic case final List<Double> doubles = BCF2Utils.toList(Double.class, value); for (final Double d : doubles) { if (d != null) { // necessary because .,. => [null, null] in VC encoder.encodeRawFloat(d); count++; } } } for (; count < minValues; count++) encoder.encodeRawMissingValue(type); }
/** * Write the field key (dictionary offset and type) into the BCF2Encoder stream * * @param encoder where we write our dictionary offset * @throws IOException */ public final void writeFieldKey(final BCF2Encoder encoder) throws IOException { encoder.encodeTypedInt(dictionaryOffset, dictionaryOffsetType); }
@Override public void encodeValue( final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { encoder.encodeRawBytes(1, getStaticType()); }