/** * 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); }
/** * 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); }
/** * Write the field key (dictionary offset and type) into the BCF2Encoder stream * * @param encoder where we write our dictionary offset * @throws IOException */ @Requires("encoder != null") public final void writeFieldKey(final BCF2Encoder encoder) throws IOException { encoder.encodeTypedInt(dictionaryOffset, dictionaryOffsetType); }
public final void encodeTypedInt(final int v) throws IOException { final BCF2Type type = BCF2Utils.determineIntegerType(v); encodeTypedInt(v, type); }
public final void encodeTypedInt(final int v) throws IOException { final BCF2Type type = BCF2Utils.determineIntegerType(v); encodeTypedInt(v, type); }
public final void encodeType(final int size, final BCF2Type type) throws IOException { if ( size <= BCF2Utils.MAX_INLINE_ELEMENTS ) { final int typeByte = BCF2Utils.encodeTypeDescriptor(size, type); encodeStream.write(typeByte); } else { final int typeByte = BCF2Utils.encodeTypeDescriptor(BCF2Utils.OVERFLOW_ELEMENT_MARKER, type); encodeStream.write(typeByte); // write in the overflow size encodeTypedInt(size); } }
public final void encodeType(final int size, final BCF2Type type) throws IOException { if ( size <= BCF2Utils.MAX_INLINE_ELEMENTS ) { final int typeByte = BCF2Utils.encodeTypeDescriptor(size, type); encodeStream.write(typeByte); } else { final int typeByte = BCF2Utils.encodeTypeDescriptor(BCF2Utils.OVERFLOW_ELEMENT_MARKER, type); encodeStream.write(typeByte); // write in the overflow size encodeTypedInt(size); } }
@Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeTypedInt(final int v) throws IOException { final BCF2Type type = BCF2Utils.determineIntegerType(v); encodeTypedInt(v, type); }
public final void encodeTyped(final Object value, final BCF2Type type) throws IOException { if ( value == null ) encodeTypedMissing(type); else { switch ( type ) { case INT8: case INT16: case INT32: encodeTypedInt((Integer)value, type); break; case FLOAT: encodeTypedFloat((Double) value); break; case CHAR: encodeTypedString((String) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } }
public final void encodeTyped(final Object value, final BCF2Type type) throws IOException { if ( value == null ) encodeTypedMissing(type); else { switch ( type ) { case INT8: case INT16: case INT32: encodeTypedInt((Integer)value, type); break; case FLOAT: encodeTypedFloat((Double) value); break; case CHAR: encodeTypedString((String) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } }
@Requires("size >= 0") @Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeType(final int size, final BCF2Type type) throws IOException { if ( size <= BCF2Utils.MAX_INLINE_ELEMENTS ) { final int typeByte = BCF2Utils.encodeTypeDescriptor(size, type); encodeStream.write(typeByte); } else { final int typeByte = BCF2Utils.encodeTypeDescriptor(BCF2Utils.OVERFLOW_ELEMENT_MARKER, type); encodeStream.write(typeByte); // write in the overflow size encodeTypedInt(size); } }
@Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeTyped(final Object value, final BCF2Type type) throws IOException { if ( value == null ) encodeTypedMissing(type); else { switch ( type ) { case INT8: case INT16: case INT32: encodeTypedInt((Integer)value, type); break; case FLOAT: encodeTypedFloat((Double) value); break; case CHAR: encodeTypedString((String) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } }
@Override public void encode(final BCF2Encoder encoder, final BCF2TypedValue tv) throws IOException { switch ( tv.type ) { case INT8: case INT16: case INT32: encoder.encodeTypedInt((Integer)tv.value, tv.type); break; case FLOAT: encoder.encodeTypedFloat((Double)tv.value); break; case CHAR: encoder.encodeTypedString((String)tv.value); break; } } });