Encodes the given float into exactly 4 bytes.

@param value float value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array
196257
public static void encode(float value, byte[] dst, int dstOffset) {
        int bits = Float.floatToIntBits(value);
        bits ^= (bits < 0) ? 0xffffffff : 0x80000000;
        dst[dstOffset    ] = (byte)(bits >> 24);
        dst[dstOffset + 1] = (byte)(bits >> 16);
        dst[dstOffset + 2] = (byte)(bits >> 8);
        dst[dstOffset + 3] = (byte)bits;
    }
1223010
public void setFloat(String name, float value) throws UnsupportedEncodingException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFloat", new Float(value));
    getBodyMap().put(name, new Float(value));
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFloat");
  }
797634
public final void putFloat(Object parent, long offset, float value) {
		THE_UNSAFE.putFloat(parent, offset, value);
	}
651842
public static void copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int length) {
		System.arraycopy(src, srcOffset, dst, dstOffset, length);
	}
507095
public static void setInt32(byte[] dst, int offset, long value)
            throws IllegalArgumentException {
        
        assert value <= Integer.MAX_VALUE : "value out of range";
        
        dst[offset + 0] = (byte) (value & 0xFF);
        dst[offset + 1] = (byte) ((value >>> 8) & 0xFF);
        dst[offset + 2] = (byte) ((value >>> 16) & 0xFF);
        dst[offset + 3] = (byte) ((value >>> 24) & 0xFF);
    }
84948
public void putFloat(Float val) throws IOException {
    putInt(java.lang.Float.floatToIntBits(val.getValue()));
  }
798298
public void write(GroupAddress dst, int value, String scale)
		throws KNXTimeoutException, KNXFormatException, KNXLinkClosedException
	{
		final DPTXlator8BitUnsigned t = new DPTXlator8BitUnsigned(scale);
		t.setValue(value);
		write(dst, priority, t);
	}
535001
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;

        SMBUtil.writeInt2(this.hashAlgos != null ? this.hashAlgos.length : 0, dst, dstIndex);
        SMBUtil.writeInt2(this.salt != null ? this.salt.length : 0, dst, dstIndex + 2);
        dstIndex += 4;

        if ( this.hashAlgos != null ) {
            for ( int hashAlgo : this.hashAlgos ) {
                SMBUtil.writeInt2(hashAlgo, dst, dstIndex);
                dstIndex += 2;
            }
        }

        if ( this.salt != null ) {
            System.arraycopy(this.salt, 0, dst, dstIndex, this.salt.length);
            dstIndex += this.salt.length;
        }

        return dstIndex - start;
    }
274851
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;
        SMBUtil.writeInt8(this.offset, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt8(this.length, dst, dstIndex);
        dstIndex += 8;

        SMBUtil.writeInt4(this.flags, dst, dstIndex);
        dstIndex += 4;
        dstIndex += 4; // Reserved
        return dstIndex - start;
    }
931184
private Item newFloat(final float value) {
        Item result = get(key.set(FLOAT, value));
        if (result == null) {
            pool.putByte(FLOAT).putInt(Float.floatToIntBits(value));
            result = new Item(poolIndex++, key);
            put(result);
        }
        return result;
    }
753745
public byte[] getData(byte[] dst, int offset)
	{
		final int items = Math.min(data.length, dst.length - offset) / stringLength;
		final int end = items * stringLength;
		if (end == 0)
			logger.error("destination range has to be multiple of 14 bytes "
				+ "for KNX strings");
		for (int i = 0; i < end; ++i)
			dst[offset + i] = (byte) data[i];
		return dst;
	}

	/* (non-Javadoc)
	 * @see tuwien.auto.calimero.dptxlator.DPTXlator#getSubTypes()
	 */
	public final Map getSubTypes()
	{
		return types;
	}

	/**
	 * @return the subtypes of the string translator type
	 * @see DPTXlator#getSubTypesStatic()
	 */
	protected static Map getSubTypesStatic()
	{
		return types;
	}

	private String fromDPT(int index)
	{
		final int offset = index * stringLength;
		final char[] output = new char[stringLength];
		int strlen = 0;
		for (int i = offset; i < (offset + stringLength) && data[i] != 0; ++i) {
			output[strlen] = (char) data[i];
			++strlen;
		}
		return new String(output, 0, strlen);
	}

	private void toDPT(byte[] buf, int offset)
	{
		// check character set, default to ASCII 7 bit encoding
		int rangeMax = 0x7f;
		if (dpt.equals(DPT_STRING_8859_1))
			rangeMax = 0xff;
		final int items = (buf.length - offset) / stringLength;
		if (items == 0) {
			logger.error("source range has to be multiple of 14 bytes for KNX strings");
			return;
		}
		data = new short[items * stringLength];
		// 7 bit encoded characters of ISO-8859-1 are equal to ASCII
		// the lower 256 characters of UCS correspond to ISO-8859-1
		for (int i = 0; i < data.length; ++i) {
			final short c = ubyte(buf[offset + i]);
			data[i] = c <= rangeMax ? c : replacement;
		}
	}
913061
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;
        SMBUtil.writeInt8(this.sourceOffset, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt8(this.targetOffset, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt4(this.length, dst, dstIndex);
        dstIndex += 4;
        dstIndex += 4; // reserved
        return dstIndex - start;
    }
336433
public JBBPTextWriter Float(final float[] values, int off, int len) throws IOException {
    while (len-- > 0) {
      this.Float(values[off++]);
    }
    return this;
  }
989736
public static void writeUnsignedShort(byte[] bytes, int value, int offset) {
        bytes[offset] = (byte) (0xFF & (value >> 8));
        bytes[offset + 1] = (byte) (0xFF & value);
    }
495821
@Override
	protected void toDPT(final String value, final short[] dst, final int index)
		throws KNXFormatException
	{
		try {
			toDPT(Long.decode(removeUnit(value)).longValue(), dst, index);
		}
		catch (final NumberFormatException e) {
			throw newException("wrong value format", value);
		}
	}
360161
public void writeDouble(double value)
        throws IOException
    {
        long bits = Double.doubleToLongBits(value);

        os.write('D');
        os.write((byte) (bits >> 56));
        os.write((byte) (bits >> 48));
        os.write((byte) (bits >> 40));
        os.write((byte) (bits >> 32));
        os.write((byte) (bits >> 24));
        os.write((byte) (bits >> 16));
        os.write((byte) (bits >> 8));
        os.write((byte) (bits));
    }
848729
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        System.arraycopy(this.bytes, this.off, dst, dstIndex, this.len);
        return this.len;
    }