当前位置: 首页>>代码示例>>Java>>正文


Java DataOutput.writeFloat方法代码示例

本文整理汇总了Java中java.io.DataOutput.writeFloat方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutput.writeFloat方法的具体用法?Java DataOutput.writeFloat怎么用?Java DataOutput.writeFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.DataOutput的用法示例。


在下文中一共展示了DataOutput.writeFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serialize

import java.io.DataOutput; //导入方法依赖的package包/类
public void serialize(DataOutput buf, WeaponData data) throws IOException {
	buf.writeByte(this.id);
	switch (type) {
	case BOOLEAN:
		buf.writeBoolean(getBoolean(data));
		break;
	case INTEGER:
		buf.writeInt(getInt(data));
		break;
	case DOUBLE:
		buf.writeFloat(getFloat(data));
		break;
	case STRING:
		buf.writeUTF(getString(data));
		break;
	default:
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:WeaponData.java

示例2: writeJunk

import java.io.DataOutput; //导入方法依赖的package包/类
private static void writeJunk(DataOutput out, Random r, long seed, int iter)
    throws IOException  {
  r.setSeed(seed);
  for (int i = 0; i < iter; ++i) {
    switch (r.nextInt(7)) {
      case 0: out.writeByte(r.nextInt()); break;
      case 1: out.writeShort((short)(r.nextInt() & 0xFFFF)); break;
      case 2: out.writeInt(r.nextInt()); break;
      case 3: out.writeLong(r.nextLong()); break;
      case 4: out.writeDouble(r.nextDouble()); break;
      case 5: out.writeFloat(r.nextFloat()); break;
      case 6:
        byte[] b = new byte[r.nextInt(1024)];
        r.nextBytes(b);
        out.write(b);
        break;
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:TestDataByteBuffers.java

示例3: write

import java.io.DataOutput; //导入方法依赖的package包/类
public synchronized void write(DataOutput out) throws IOException {
  jobid.write(out);
  out.writeFloat(setupProgress);
  out.writeFloat(mapProgress);
  out.writeFloat(reduceProgress);
  out.writeFloat(cleanupProgress);
  WritableUtils.writeEnum(out, runState);
  out.writeLong(startTime);
  Text.writeString(out, user);
  WritableUtils.writeEnum(out, priority);
  Text.writeString(out, schedulingInfo);
  out.writeLong(finishTime);
  out.writeBoolean(isRetired);
  Text.writeString(out, historyFile);
  Text.writeString(out, jobName);
  Text.writeString(out, trackingUrl);
  Text.writeString(out, jobFile);
  out.writeBoolean(isUber);

  // Serialize the job's ACLs
  out.writeInt(jobACLs.size());
  for (Entry<JobACL, AccessControlList> entry : jobACLs.entrySet()) {
    WritableUtils.writeEnum(out, entry.getKey());
    entry.getValue().write(out);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:JobStatus.java

示例4: write

import java.io.DataOutput; //导入方法依赖的package包/类
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  Text.writeString(out, state);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  WritableUtils.writeStringArray(out, diagnostics);
  counters.write(out);
  WritableUtils.writeEnum(out, currentStatus);
  if (currentStatus == TIPStatus.RUNNING) {
    WritableUtils.writeVInt(out, runningAttempts.size());
    TaskAttemptID t[] = new TaskAttemptID[0];
    t = runningAttempts.toArray(t);
    for (int i = 0; i < t.length; i++) {
      t[i].write(out);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.write(out);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TaskReport.java

示例5: writeFloatArray

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * 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 (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
    logger.trace(LogMarker.SERIALIZER, "Writing float array of length {}", length);
  }
  if (length > 0) {
    for (int i = 0; i < length; i++) {
      out.writeFloat(array[i]);
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:29,代码来源:DataSerializer.java

示例6: loadConfig

import java.io.DataOutput; //导入方法依赖的package包/类
public static void loadConfig(File file,DataOutput output) {
	/*
	 * Configuration weaponsFile= new Configuration(file);
	 * weaponsFile.load();
	 */
	ArrayList<WeaponData> list = WeaponData.parseFile(file);
	for (WeaponData data : list) {
		String weaponEntry = data.getName();
		// Class<?> weaponClass =
		// MapList.weaponClasses.get(weaponData.get("Class").getString());
		try {
			// System.out.println("attach "+weaponEntry);
			if (PropertyType.BASED_ON.hasKey(data) && MapList.nameToData.containsKey(PropertyType.BASED_ON.getString(data)))
				data = attach(MapList.nameToData.get(PropertyType.BASED_ON.getString(data)), data);
			loadWeapon(weaponEntry, data);
			
			output.writeUTF(data.getName());
			output.writeByte(data.properties.size());
			for (PropertyType type : data.properties.keySet()){
				
				type.serialize(output, data);
			}
			output.writeByte(Math.max(data.attributes.size(), data.crateContent.size()));
			for (Entry<TF2Attribute, Float> attr : data.attributes.entrySet()) {
				output.writeByte(attr.getKey().id);
				output.writeFloat(attr.getValue());
			}
			for (Entry<String, Integer> entry : data.crateContent.entrySet()) {
				output.writeUTF(entry.getKey());
				output.writeFloat(entry.getValue());
			}

		} catch (Exception var4) {
			var4.printStackTrace();
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:38,代码来源:TF2weapons.java

示例7: write2DArray

import java.io.DataOutput; //导入方法依赖的package包/类
private void write2DArray(DataOutput out, float[][] f) throws IOException {
    for(int i=0;i<f.length;i++){
        float[] g=f[i];
        for(int j=0;j<g.length;j++){
            out.writeFloat(g[j]);
        }
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:MotionData.java

示例8: write

import java.io.DataOutput; //导入方法依赖的package包/类
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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TaskStatus.java

示例9: writeFloat

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * Writes an instance of <code>Float</code> to a <code>DataOutput</code>.
 *
 * @throws IOException A problem occurs while writing to <code>out</code>
 * @throws NullPointerException if value is null.
 *
 * @see #readFloat
 */
public static void writeFloat(Float value, DataOutput out) throws IOException {

  InternalDataSerializer.checkOut(out);

  if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
    logger.trace(LogMarker.SERIALIZER, "Writing Float {}", value);
  }

  out.writeFloat(value.floatValue());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:DataSerializer.java

示例10: writePrimitiveFloat

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * 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 GemFire 5.1
 */
public static void writePrimitiveFloat(float value, DataOutput out) throws IOException {

  InternalDataSerializer.checkOut(out);

  if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
    logger.trace(LogMarker.SERIALIZER, "Writing Float {}", value);
  }

  out.writeFloat(value);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:DataSerializer.java

示例11: writeFloatArray

import java.io.DataOutput; //导入方法依赖的package包/类
private void writeFloatArray(DataOutput out) throws IOException {
  float[] v = (float[]) value;
  for (int i = 0; i < length; i++)
    out.writeFloat(v[i]);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:6,代码来源:ArrayPrimitiveWritable.java

示例12: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
protected void write(final DataOutput output) throws IOException {
  output.writeFloat(this.value);
}
 
开发者ID:KyoriPowered,项目名称:nbt,代码行数:5,代码来源:FloatTag.java

示例13: writeStream

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeStream(final DataOutput data,
        final Float value) throws IOException
{
    data.writeFloat(value);
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:7,代码来源:DataTypeList.java

示例14: write

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * Write the actual data contents of the tag, implemented in NBT extension classes
 */
void write(DataOutput output) throws IOException
{
    output.writeFloat(this.data);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:NBTTagFloat.java

示例15: toData

import java.io.DataOutput; //导入方法依赖的package包/类
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.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.compressorDesc, out);
  out.writeBoolean(this.offHeap);
  DataSerializer.writeObject(this.customAttributes, out);
  DataSerializer.writeString(this.regionMapFactory, out);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:48,代码来源:RemoteRegionAttributes.java


注:本文中的java.io.DataOutput.writeFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。