java.io.DataOutput#writeFloat ( )源码实例Demo

下面列出了java.io.DataOutput#writeFloat ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gemfirexd-oss   文件: DataSerializer.java
/**
 * Writes an array of <code>float</code>s to a
 * <code>DataOutput</code>.
 * This method will serialize a
 * <code>null</code> array and not throw a
 * <code>NullPointerException</code>.
 *
 * @throws IOException
 *         A problem occurs while writing to <code>out</code>
 *
 * @see #readFloatArray
 */
public static void writeFloatArray(float[] array, DataOutput out)
  throws IOException {

  InternalDataSerializer.checkOut(out);

  int length;
  if (array == null) {
    length = -1;
  } else {
    length = array.length;
  }
  InternalDataSerializer.writeArrayLength(length, out);
  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Writing float array of length " + length);
  }
  if (length > 0) {
    for (int i = 0; i < length; i++) {
      out.writeFloat(array[i]);
    }
  }
}
 
源代码2 项目: gemfirexd-oss   文件: DataSerializer.java
/**
 * Writes an array of <code>float</code>s to a
 * <code>DataOutput</code>.
 * This method will serialize a
 * <code>null</code> array and not throw a
 * <code>NullPointerException</code>.
 *
 * @throws IOException
 *         A problem occurs while writing to <code>out</code>
 *
 * @see #readFloatArray
 */
public static void writeFloatArray(float[] array, DataOutput out)
  throws IOException {

  InternalDataSerializer.checkOut(out);

  int length;
  if (array == null) {
    length = -1;
  } else {
    length = array.length;
  }
  InternalDataSerializer.writeArrayLength(length, out);
  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Writing float array of length " + length);
  }
  if (length > 0) {
    for (int i = 0; i < length; i++) {
      out.writeFloat(array[i]);
    }
  }
}
 
源代码3 项目: data-polygamy   文件: FrameworkUtils.java
@Override
public void write(DataOutput out) throws IOException {
    // spatial
    out.writeInt(this.spatial);
    
    // temporal
    out.writeInt(this.temporal);
    
    // attribute
    out.writeFloat(this.value);
}
 
源代码4 项目: gemfirexd-oss   文件: SQLReal.java
@Override
public void toData(DataOutput out) throws IOException {
  if (!isNull()) {
    out.writeByte(getTypeId());
    out.writeFloat(this.value);
    return;
  }
  this.writeNullDVD(out);
}
 
源代码5 项目: vxquery   文件: SubtractOperation.java
@Override
public void operateIntegerFloat(LongPointable longp, FloatPointable floatp, DataOutput dOut)
        throws SystemException, IOException {
    float value = longp.floatValue();
    value -= floatp.floatValue();
    dOut.write(ValueTag.XS_FLOAT_TAG);
    dOut.writeFloat(value);
}
 
源代码6 项目: gemfirexd-oss   文件: DataSerializer.java
/**
 * Writes a primitive <code>float</code> to a
 * <code>DataOutput</code>.
 *
 * @throws IOException
 *         A problem occurs while writing to <code>out</code>
 *
 * @see DataOutput#writeFloat
 * @since 5.1
 */
public static void writePrimitiveFloat(float value, DataOutput out)
  throws IOException {

  InternalDataSerializer.checkOut(out);

  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Writing Float " + value);
  }

  out.writeFloat(value);
}
 
源代码7 项目: vxquery   文件: ModOperation.java
@Override
public void operateFloatDecimal(FloatPointable floatp, XSDecimalPointable decp, DataOutput dOut)
        throws SystemException, IOException {
    float value = floatp.floatValue();
    value %= decp.floatValue();
    dOut.write(ValueTag.XS_FLOAT_TAG);
    dOut.writeFloat(value);
}
 
源代码8 项目: big-c   文件: TaskStatus.java
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  out.writeInt(numSlots);
  WritableUtils.writeEnum(out, runState);
  Text.writeString(out, diagnosticInfo);
  Text.writeString(out, stateString);
  WritableUtils.writeEnum(out, phase);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  out.writeBoolean(includeAllCounters);
  out.writeLong(outputSize);
  counters.write(out);
  nextRecordRange.write(out);
}
 
源代码9 项目: eagle   文件: FloatSerializer.java
@Override
public void serialize(Object value, DataOutput dataOutput) throws IOException {
    if (value instanceof Number) {
        value = ((Number)value).floatValue();
    }
    dataOutput.writeFloat((float)value);
}
 
源代码10 项目: gemfirexd-oss   文件: MapLiteSerializer.java
public static void writeFloat(Float value, DataOutput output) throws IOException
{
	if (value == null) {
		output.writeFloat(0);
	} else {
		output.writeFloat(value);
	}
}
 
源代码11 项目: multimedia-indexing   文件: FloatArrayWritable.java
public void write(DataOutput out) throws IOException {
    int length = 0;
    if (data != null) {
        length = data.length;
    }

    out.writeInt(length);

    for (int i = 0; i < length; i++) {
        out.writeFloat(data[i]);
    }
}
 
源代码12 项目: gemfirexd-oss   文件: DeltaObject.java
protected void _toDelta(DataOutput out) throws IOException {
   Log.getLogWriter().info("In DeltaObject.toDelta, for " + this + "\n" + "with DataOutput " + out);
   DeltaObserver.addToDeltaKey(extra);

   // for validation later, encode with a toDelta id number
   long toDeltaIdNumber = DeltaPropagationBB.getBB().getSharedCounters().incrementAndRead(DeltaPropagationBB.toDeltaIdNumber);
   out.writeLong(toDeltaIdNumber);
   Log.getLogWriter().info("Wrote toDeltaIdNumber " + toDeltaIdNumber);

   out.writeBoolean(aPrimitiveLongChanged);
   if (aPrimitiveLongChanged) {
      out.writeLong(aPrimitiveLong);
      Log.getLogWriter().info("Wrote changed field aPrimitiveLong " + aPrimitiveLong);
   }
   out.writeBoolean(aPrimitiveIntChanged);
   if (aPrimitiveIntChanged) {
      out.writeInt(aPrimitiveInt);
      Log.getLogWriter().info("Wrote changed field aPrimitiveInt " + aPrimitiveInt);
   }
   out.writeBoolean(aPrimitiveShortChanged);
   if (aPrimitiveShortChanged) {
      out.writeShort(aPrimitiveShort);
      Log.getLogWriter().info("Wrote changed field aPrimitiveShort " + aPrimitiveShort);
   }
   out.writeBoolean(aPrimitiveFloatChanged);
   if (aPrimitiveFloatChanged) {
      out.writeFloat(aPrimitiveFloat);
      Log.getLogWriter().info("Wrote changed field aPrimitiveFloat " + aPrimitiveFloat);
   }
   out.writeBoolean(aPrimitiveDoubleChanged);
   if (aPrimitiveDoubleChanged) {
      out.writeDouble(aPrimitiveDouble);
      Log.getLogWriter().info("Wrote changed field aPrimitiveDouble " + aPrimitiveDouble);
   }
   out.writeBoolean(aPrimitiveByteChanged);
   if (aPrimitiveByteChanged) {
      out.writeByte(aPrimitiveByte);
      Log.getLogWriter().info("Wrote changed field aPrimitiveByte " + aPrimitiveByte);
   }
   out.writeBoolean(aPrimitiveCharChanged);
   if (aPrimitiveCharChanged) {
      out.writeChar(aPrimitiveChar);
      Log.getLogWriter().info("Wrote changed field aPrimitiveChar " + aPrimitiveChar);
   }
   out.writeBoolean(aPrimitiveBooleanChanged);
   if (aPrimitiveBooleanChanged) {
      out.writeBoolean(aPrimitiveBoolean);
      Log.getLogWriter().info("Wrote changed field aPrimitiveBoolean " + aPrimitiveBoolean);
   }
   out.writeBoolean(aByteArrayChanged);
   if (aByteArrayChanged) {
      out.writeInt(aByteArray.length);
      out.write(aByteArray);
      Log.getLogWriter().info("Wrote changed field aByteArray of length " + aByteArray.length);
   }
   out.writeBoolean(aStringChanged);
   if (aStringChanged) {
      out.writeInt(aString.length());
      out.writeBytes(aString);
      Log.getLogWriter().info("Wrote changed field aString " + aString);
   }
   out.writeInt(END_SIGNAL.length());
   out.writeBytes(END_SIGNAL);
   Log.getLogWriter().info("Wrote end signal: " + END_SIGNAL);
   Log.getLogWriter().info("Done writing in DeltaObject.toDelta for " + this);
}
 
源代码13 项目: MikuMikuStudio   文件: PMDSkinVertData.java
public void writeToStream(DataOutput os) throws IOException {
    os.writeInt(skinVertIndex);
    os.writeFloat(skinVertPos.x);
    os.writeFloat(skinVertPos.y);
    os.writeFloat(-skinVertPos.z);
}
 
源代码14 项目: vxquery   文件: CastToFloatOperation.java
@Override
public void convertDecimal(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
    float value = decp.floatValue();
    dOut.write(ValueTag.XS_FLOAT_TAG);
    dOut.writeFloat(value);
}
 
public void write(DataOutput out) throws IOException {
	out.writeFloat(count);
	out.writeFloat(average);
}
 
源代码16 项目: data-polygamy   文件: Average.java
@Override
public void write(DataOutput out) throws IOException {
    out.writeFloat(sum);
    out.writeInt(count);
}
 
源代码17 项目: gemfirexd-oss   文件: DeltaObject.java
protected void _toDelta(DataOutput out) throws IOException {
   Log.getLogWriter().info("In DeltaObject.toDelta, for " + this + "\n" + "with DataOutput " + out);
   DeltaObserver.addToDeltaKey(extra);

   // for validation later, encode with a toDelta id number
   long toDeltaIdNumber = DeltaPropagationBB.getBB().getSharedCounters().incrementAndRead(DeltaPropagationBB.toDeltaIdNumber);
   out.writeLong(toDeltaIdNumber);
   Log.getLogWriter().info("Wrote toDeltaIdNumber " + toDeltaIdNumber);

   out.writeBoolean(aPrimitiveLongChanged);
   if (aPrimitiveLongChanged) {
      out.writeLong(aPrimitiveLong);
      Log.getLogWriter().info("Wrote changed field aPrimitiveLong " + aPrimitiveLong);
   }
   out.writeBoolean(aPrimitiveIntChanged);
   if (aPrimitiveIntChanged) {
      out.writeInt(aPrimitiveInt);
      Log.getLogWriter().info("Wrote changed field aPrimitiveInt " + aPrimitiveInt);
   }
   out.writeBoolean(aPrimitiveShortChanged);
   if (aPrimitiveShortChanged) {
      out.writeShort(aPrimitiveShort);
      Log.getLogWriter().info("Wrote changed field aPrimitiveShort " + aPrimitiveShort);
   }
   out.writeBoolean(aPrimitiveFloatChanged);
   if (aPrimitiveFloatChanged) {
      out.writeFloat(aPrimitiveFloat);
      Log.getLogWriter().info("Wrote changed field aPrimitiveFloat " + aPrimitiveFloat);
   }
   out.writeBoolean(aPrimitiveDoubleChanged);
   if (aPrimitiveDoubleChanged) {
      out.writeDouble(aPrimitiveDouble);
      Log.getLogWriter().info("Wrote changed field aPrimitiveDouble " + aPrimitiveDouble);
   }
   out.writeBoolean(aPrimitiveByteChanged);
   if (aPrimitiveByteChanged) {
      out.writeByte(aPrimitiveByte);
      Log.getLogWriter().info("Wrote changed field aPrimitiveByte " + aPrimitiveByte);
   }
   out.writeBoolean(aPrimitiveCharChanged);
   if (aPrimitiveCharChanged) {
      out.writeChar(aPrimitiveChar);
      Log.getLogWriter().info("Wrote changed field aPrimitiveChar " + aPrimitiveChar);
   }
   out.writeBoolean(aPrimitiveBooleanChanged);
   if (aPrimitiveBooleanChanged) {
      out.writeBoolean(aPrimitiveBoolean);
      Log.getLogWriter().info("Wrote changed field aPrimitiveBoolean " + aPrimitiveBoolean);
   }
   out.writeBoolean(aByteArrayChanged);
   if (aByteArrayChanged) {
      out.writeInt(aByteArray.length);
      out.write(aByteArray);
      Log.getLogWriter().info("Wrote changed field aByteArray of length " + aByteArray.length);
   }
   out.writeBoolean(aStringChanged);
   if (aStringChanged) {
      out.writeInt(aString.length());
      out.writeBytes(aString);
      Log.getLogWriter().info("Wrote changed field aString " + aString);
   }
   out.writeInt(END_SIGNAL.length());
   out.writeBytes(END_SIGNAL);
   Log.getLogWriter().info("Wrote end signal: " + END_SIGNAL);
   Log.getLogWriter().info("Done writing in DeltaObject.toDelta for " + this);
}
 
源代码18 项目: gemfirexd-oss   文件: RemoteRegionAttributes.java
public void toData(DataOutput out) throws IOException {
  DataSerializer.writeString(this.cacheLoaderDesc, out);
  DataSerializer.writeString(this.cacheWriterDesc, out);
  DataSerializer.writeStringArray(this.cacheListenerDescs, out);
  DataSerializer.writeString(this.capacityControllerDesc, out);
  DataSerializer.writeObject(this.keyConstraint, out);
  DataSerializer.writeObject(this.valueConstraint, out);
  DataSerializer.writeObject(this.rTtl, out);
  DataSerializer.writeObject(this.rIdleTimeout, out);
  DataSerializer.writeObject(this.eTtl, out);
  DataSerializer.writeString(this.customEttlDesc, out);
  DataSerializer.writeObject(this.eIdleTimeout, out);
  DataSerializer.writeString(this.customEIdleDesc, out);
  DataSerializer.writeObject(this.dataPolicy, out);
  DataSerializer.writeObject(this.scope, out);
  out.writeBoolean(this.statsEnabled);
  out.writeBoolean(this.ignoreJTA);
  out.writeInt(this.concurrencyLevel);
  out.writeFloat(this.loadFactor);
  out.writeInt(this.initialCapacity);
  out.writeBoolean(this.earlyAck);
  out.writeBoolean(this.multicastEnabled);
  out.writeBoolean(this.enableGateway);
  DataSerializer.writeString(this.gatewayHubId, out);
  out.writeBoolean(this.enableSubscriptionConflation);
  out.writeBoolean(this.publisher);
  out.writeBoolean(this.enableAsyncConflation);

  DataSerializer.writeObject(this.diskWriteAttributes, out);
  DataSerializer.writeObject(this.diskDirs, out);
  DataSerializer.writeObject(this.diskSizes, out);
  out.writeBoolean(this.indexMaintenanceSynchronous);
  DataSerializer.writeObject(this.partitionAttributes, out);
  DataSerializer.writeObject(this.membershipAttributes, out);
  DataSerializer.writeObject(this.subscriptionAttributes, out);
  DataSerializer.writeObject(this.evictionAttributes, out);
  out.writeBoolean(this.cloningEnable);
  DataSerializer.writeString(this.diskStoreName, out);
  out.writeBoolean(this.isDiskSynchronous);
  DataSerializer.writeStringArray(this.gatewaySendersDescs, out);
  out.writeBoolean(this.isGatewaySenderEnabled);

  out.writeBoolean(this.concurrencyChecksEnabled);
  DataSerializer.writeString(this.hdfsStoreName, out);
  DataSerializer.writeString(this.compressorDesc, out);
  out.writeBoolean(this.enableOffHeapMemory);
}
 
源代码19 项目: MikuMikuStudio   文件: PMDUtil.java
public static void writeVector3f(DataOutput os, Vector3f v) throws IOException{
    os.writeFloat(v.x);
    os.writeFloat(v.y);
    os.writeFloat(-v.z);
}
 
源代码20 项目: gemfirexd-oss   文件: MemoryThresholds.java
/**
 * Write the state of this to the DataOutput
 * 
 * @param out
 *          DataOutput on which to write internal state
 * @throws IOException
 */
public void toData(DataOutput out) throws IOException {
  out.writeLong(this.maxMemoryBytes);
  out.writeFloat(this.criticalThreshold);
  out.writeFloat(this.evictionThreshold);
}