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

The following examples show how to use java.io.DataInput#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: DataSerializer.java    From gemfirexd-oss with 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
Source File: SuperQueryWritable.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: StorageSerialization.java    From PalDB with 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 4
Source File: FuzzyQueryWritable.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: FrameworkUtils.java    From data-polygamy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 6
Source File: ExampleObject.java    From gemfirexd-oss with 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 7
Source File: Instrument.java    From gemfirexd-oss with 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 8
Source File: FrameworkUtils.java    From data-polygamy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 File: DataSerializer.java    From gemfirexd-oss with 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 10
Source File: Node.java    From anthelion with 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 11
Source File: JobStatus.java    From RDFS with 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 12
Source File: Instrument.java    From gemfirexd-oss with 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 13
Source File: Gradient.java    From data-polygamy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 14
Source File: TypeAdapterRegistry.java    From BungeeTabListPlus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Float read(DataInput input) throws IOException {
    return input.readFloat();
}
 
Example 15
Source File: Bytecode5xClassParser.java    From Bytecoder with 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 16
Source File: FloatSerializer.java    From util with Apache License 2.0 4 votes vote down vote up
@Override
public Float read(final DataInput in) throws IOException {
    return in.readFloat();
}
 
Example 17
Source File: FloatWritable.java    From DataVec with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    value = in.readFloat();
}
 
Example 18
Source File: SQLReal.java    From gemfirexd-oss with 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 19
Source File: FloatSerializer.java    From eagle with Apache License 2.0 4 votes vote down vote up
@Override
public Object deserialize(DataInput dataInput) throws IOException {
    return dataInput.readFloat();
}
 
Example 20
Source File: SmartFloatSerializer.java    From mph-table with Apache License 2.0 4 votes vote down vote up
@Override
public Float read(final DataInput in) throws IOException {
    return in.readFloat();
}