Java Code Examples for java.io.DataInput#readFloat()

The following examples show how to use java.io.DataInput#readFloat() . These examples are extracted from open source projects. 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 Project: gemfirexd-oss   File: DataSerializer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Reads an array of <code>float</code>s from a
 * <code>DataInput</code>.
 *
 * @throws IOException
 *         A problem occurs while reading from <code>in</code>
 *
 * @see #writeFloatArray
 */
public static float[] readFloatArray(DataInput in)
  throws IOException {

    InternalDataSerializer.checkIn(in);

    int length = InternalDataSerializer.readArrayLength(in);
    if (length == -1) {
      return null;
    } else {
      float[] array = new float[length];
      for (int i = 0; i < length; i++) {
        array[i] = in.readFloat();
      }

      if (DEBUG) {
        InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read float array of length " + length);
      }

      return array;
    }
  }
 
Example 2
@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    values = new HashMap<Integer, Pair>(size);
    for (int i = 0; i < size; i++) {
        int time = in.readInt();
        float val = in.readFloat();
        int count = in.readInt();
        values.put(time, new Pair(val, count));
    }
}
 
Example 3
Source Project: gemfirexd-oss   File: Instrument.java    License: Apache License 2.0 5 votes vote down vote up
public void fromData(DataInput input) throws IOException,
    ClassNotFoundException {
  id_imnt = input.readInt();
  nm_imnt = DataSerializer.readString(input);
  id_typ_imnt = DataSerializer.readString(input);
  id_ccy_main = DataSerializer.readString(input);
  am_sz_ctrt = input.readFloat();
  id_sector = input.readInt();
  id_ctry_issuer = DataSerializer.readString(input);
}
 
Example 4
Source Project: RDFS   File: JobStatus.java    License: Apache License 2.0 5 votes vote down vote up
public synchronized void readFields(DataInput in) throws IOException {
  this.jobid = JobID.read(in);
  this.setupProgress = in.readFloat();
  this.mapProgress = in.readFloat();
  this.reduceProgress = in.readFloat();
  this.cleanupProgress = in.readFloat();
  this.runState = in.readInt();
  this.startTime = in.readLong();
  this.user = Text.readString(in);
  this.priority = WritableUtils.readEnum(in, JobPriority.class);
  this.schedulingInfo = Text.readString(in);
}
 
Example 5
Source Project: anthelion   File: Node.java    License: Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in)
  throws IOException {

  numInlinks = in.readInt();
  numOutlinks = in.readInt();
  inlinkScore = in.readFloat();
  metadata.clear();
  metadata.readFields(in);
}
 
Example 6
Source Project: gemfirexd-oss   File: DataSerializer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Reads a primitive <code>float</code> from a
 * <code>DataInput</code>.
 *
 * @throws IOException
 *         A problem occurs while reading from <code>in</code>
 * @see DataInput#readFloat
 * @since 5.1
 */
public static float readPrimitiveFloat(DataInput in) throws IOException {
  InternalDataSerializer.checkIn(in);

  float value = in.readFloat();
  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read Float " + value);
  }
  return value;
}
 
Example 7
@Override
public void readFields(DataInput in) throws IOException {
  QueryWritable queryWritable = new QueryWritable();
  queryWritable.readFields(in);
  Query subQuery = queryWritable.getQuery();
  float boost = in.readFloat();
  TermWritable termWritable = new TermWritable();
  termWritable.readFields(in);
  Term primeDocTerm = termWritable.getTerm();
  String scoreType = IOUtil.readString(in);

  query = new SuperQuery(subQuery, ScoreType.valueOf(scoreType), primeDocTerm);
  query.setBoost(boost);
}
 
Example 8
@Override
public void readFields(DataInput in) throws IOException {
    // spatial
    this.spatial = in.readInt();
    
    // temporal
    this.temporal = in.readInt();
    
    // value
    this.value = in.readFloat();
}
 
Example 9
Source Project: gemfirexd-oss   File: Instrument.java    License: Apache License 2.0 5 votes vote down vote up
public void fromData(DataInput input) throws IOException,
    ClassNotFoundException {
  id_imnt = input.readInt();
  nm_imnt = DataSerializer.readString(input);
  id_typ_imnt = DataSerializer.readString(input);
  id_ccy_main = DataSerializer.readString(input);
  am_sz_ctrt = input.readFloat();
  id_sector = input.readInt();
  id_ctry_issuer = DataSerializer.readString(input);
}
 
Example 10
Source Project: gemfirexd-oss   File: ExampleObject.java    License: Apache License 2.0 5 votes vote down vote up
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
	this.doubleField = in.readDouble();
	this.floatField = in.readFloat();
	this.longField = in.readLong();
	this.intField = in.readInt();
	this.shortField = in.readShort();
	this.stringField = in.readUTF();
	this.stringListField = new Vector<String>();
	int size = in.readInt();
	for (int i=0; i<size; i++) {
		String s = in.readUTF();
		stringListField.add(i, s);
	}
}
 
Example 11
@Override
public void readFields(DataInput in) throws IOException {
    spatial = in.readInt();
    dataset = in.readByte();
    attribute = in.readInt();
    timeSeries = new byte[in.readInt()];
    for (int i = 0; i < timeSeries.length; i++)
        timeSeries[i] = in.readByte();
    start = in.readInt();
    end = in.readInt();
    nbPosEvents = in.readInt();
    nbNegEvents = in.readInt();
    nbNonEvents = in.readInt();
    threshold = in.readFloat();
    
    /*int size = in.readInt();
    mean = new HashMap<Integer,Float>(size);
    for (int i = 0; i < size; i++) {
        int k = in.readInt();
        mean.put(k, in.readFloat());
    }
    stdDev = new HashMap<Integer,Float>(size);
    for (int i = 0; i < size; i++) {
        int k = in.readInt();
        stdDev.put(k, in.readFloat());
    }
    min = new HashMap<Integer,Float>(size);
    for (int i = 0; i < size; i++) {
        int k = in.readInt();
        min.put(k, in.readFloat());
    }
    max = new HashMap<Integer,Float>(size);
    for (int i = 0; i < size; i++) {
        int k = in.readInt();
        max.put(k, in.readFloat());
    }*/
}
 
Example 12
@Override
public void readFields(DataInput in) throws IOException {
  float boost = in.readFloat();
  TermWritable termWritable = new TermWritable();
  termWritable.readFields(in);
  Term term = termWritable.getTerm();
  int maxEdits = in.readInt();
  int prefixLength = in.readInt();
  int maxExpansions = in.readInt();
  boolean transpositions = in.readBoolean();
  query = new FuzzyQuery(term, maxEdits, prefixLength, maxExpansions, transpositions);
  query.setBoost(boost);
}
 
Example 13
Source Project: PalDB   File: StorageSerialization.java    License: Apache License 2.0 5 votes vote down vote up
private static float[] deserializeFloatArray(DataInput is)
    throws IOException {
  int size = LongPacker.unpackInt(is);
  float[] ret = new float[size];
  for (int i = 0; i < size; i++) {
    ret[i] = is.readFloat();
  }
  return ret;
}
 
Example 14
@Override
public Float read(DataInput input) throws IOException {
    return input.readFloat();
}
 
Example 15
Source Project: mph-table   File: SmartFloatSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Float read(final DataInput in) throws IOException {
    return in.readFloat();
}
 
Example 16
Source Project: gemfirexd-oss   File: SQLReal.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final void fromDataForOptimizedResultHolder(final DataInput dis)
    throws IOException, ClassNotFoundException {
  this.value = dis.readFloat();
  this.isnull = false;
}
 
Example 17
Source Project: DataVec   File: FloatWritable.java    License: Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    value = in.readFloat();
}
 
Example 18
Source Project: Bytecoder   File: Bytecode5xClassParser.java    License: Apache License 2.0 4 votes vote down vote up
private void parseConstantPool_CONSTANT_Float(final DataInput aDis, final BytecodeConstantPool aConstantPool) throws IOException {
    final float theFloat = aDis.readFloat();
    aConstantPool.registerConstant(new BytecodeFloatConstant(theFloat));
}
 
Example 19
Source Project: util   File: FloatSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Float read(final DataInput in) throws IOException {
    return in.readFloat();
}
 
Example 20
Source Project: eagle   File: FloatSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Object deserialize(DataInput dataInput) throws IOException {
    return dataInput.readFloat();
}