/** * Create an Erlang float from a stream containing a float encoded in Erlang * external format. * * @param buf * the stream containing the encoded value. * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang float. * * @exception OtpErlangRangeException * if the value cannot be represented as a Java float. */ public OtpErlangFloat(final OtpInputStream buf) throws OtpErlangDecodeException, OtpErlangRangeException { super(buf); floatValue(); } }
protected OtpErlangObject convertBasicTypeToErlang(Object obj) { if (obj instanceof byte[]) { return new OtpErlangBinary((byte[]) obj); } else if (obj instanceof Boolean) { return new OtpErlangBoolean((Boolean) obj); } else if (obj instanceof Byte) { return new OtpErlangByte((Byte) obj); } else if (obj instanceof Character) { return new OtpErlangChar((Character) obj); } else if (obj instanceof Double) { return new OtpErlangDouble((Double) obj); } else if (obj instanceof Float) { return new OtpErlangFloat((Float) obj); } else if (obj instanceof Integer) { return new OtpErlangInt((Integer) obj); } else if (obj instanceof Long) { return new OtpErlangLong((Long) obj); } else if (obj instanceof Short) { return new OtpErlangShort((Short) obj); } else if (obj instanceof String) { return new OtpErlangString((String) obj); } else { throw new ErlangConversionException( "Could not convert Java object of type [" + obj.getClass() + "] to an Erlang data type."); } }
return ((OtpErlangDouble) erlangObject).doubleValue(); } else if (erlangObject instanceof OtpErlangFloat) { return ((OtpErlangFloat) erlangObject).floatValue(); } else if (erlangObject instanceof OtpErlangInt) { return ((OtpErlangInt) erlangObject).intValue();