Java Code Examples for io.protostuff.Input#readFloat()

The following examples show how to use io.protostuff.Input#readFloat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArraySchemas.java    From protostuff with Apache License 2.0 6 votes vote down vote up
protected Object readPrimitiveFrom(Input input, Object owner, int len)
        throws IOException
{
    float[] array = new float[len];
    if (input instanceof GraphInput)
    {
        // update the actual reference.
        ((GraphInput) input).updateLast(array, owner);
    }

    for (int i = 0; i < len; i++)
    {
        if (ID_ARRAY_DATA != input.readFieldNumber(this))
            throw new ProtostuffException("Corrupt input.");

        array[i] = input.readFloat();
    }

    if (0 != input.readFieldNumber(this))
        throw new ProtostuffException("Corrupt input.");

    return array;
}
 
Example 2
Source File: ArraySchemas.java    From protostuff with Apache License 2.0 5 votes vote down vote up
protected Object readBoxedFrom(Input input, Object owner, int len)
        throws IOException
{
    final Float[] array = new Float[len];
    if (input instanceof GraphInput)
    {
        // update the actual reference.
        ((GraphInput) input).updateLast(array, owner);
    }

    for (int i = 0; i < len;)
    {
        switch (input.readFieldNumber(this))
        {
            case ID_ARRAY_DATA:
                array[i++] = input.readFloat();
                break;
            case ID_ARRAY_NULLCOUNT:
                i += input.readUInt32();
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
    }

    if (0 != input.readFieldNumber(this))
        throw new ProtostuffException("Corrupt input.");

    return array;
}
 
Example 3
Source File: RuntimeUnsafeFieldFactory.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public Float readFrom(Input input) throws IOException
{
    return new Float(input.readFloat());
}
 
Example 4
Source File: RuntimeReflectionFieldFactory.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public Float readFrom(Input input) throws IOException
{
    return new Float(input.readFloat());
}