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

The following examples show how to use io.protostuff.Input#readDouble() . 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: FieldStat.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public void mergeFrom(Input input, FieldStat message) throws IOException {
    int number;
    while ((number = input.readFieldNumber(this)) != 0) {
        switch (number) {
            case 1:
                message.field = input.readString();
                break;
            case 2:
                message.unique = input.readUInt64();
                break;
            case 3:
                message.observed = input.readUInt64();
                break;
            case 4:
                message.selectivity = input.readDouble();
                break;
            default:
                input.handleUnknownField(number, this);
        }
    }
    
}
 
Example 2
Source File: ProtostuffCodecTest.java    From c5-replicator with Apache License 2.0 6 votes vote down vote up
@Override
public void mergeFrom(Input input, SerObj message) throws IOException {
  for (int number = input.readFieldNumber(this); ; number = input.readFieldNumber(this)) {
    switch (number) {
      case 0:
        return;

      case 1:
        message.id = input.readInt32();
        break;

      case 2:
        message.desc = input.readString();
        break;

      case 3:
        message.timestamp = input.readInt64();
        break;

      case 4:
        message.cost = input.readDouble();
        break;
    }
  }
}
 
Example 3
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
{
    double[] array = new double[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.readDouble();
    }

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

    return array;
}
 
Example 4
Source File: TestProtostuffUtils.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void mergeFrom(Input input, Foo message) throws IOException {
  for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) {
    switch (number) {
    case 0:
      return;
    case 1:
      message.bar = input.readDouble();
      break;
    default:
      input.handleUnknownField(number, this);
    }
  }
}
 
Example 5
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 Double[] array = new Double[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.readDouble();
                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 6
Source File: RuntimeUnsafeFieldFactory.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public Double readFrom(Input input) throws IOException
{
    return new Double(input.readDouble());
}
 
Example 7
Source File: RuntimeReflectionFieldFactory.java    From protostuff with Apache License 2.0 4 votes vote down vote up
@Override
public Double readFrom(Input input) throws IOException
{
    return new Double(input.readDouble());
}