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


Java DataOutputView.writeFloat方法代码示例

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


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

示例1: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(float[] record, DataOutputView target) throws IOException {
	if (record == null) {
		throw new IllegalArgumentException("The record must not be null.");
	}
	
	final int len = record.length;
	target.writeInt(len);
	for (int i = 0; i < len; i++) {
		target.writeFloat(record[i]);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:FloatPrimitiveArraySerializer.java

示例2: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	out.writeInt(position);

	for (int i = 0; i < position; i++) {
		out.writeFloat(data[i]);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:FloatValueArray.java

示例3: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(Float record, DataOutputView target) throws IOException {
	target.writeFloat(record.floatValue());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:FloatSerializer.java

示例4: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeFloat(source.readFloat());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:FloatSerializer.java

示例5: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	out.writeFloat(this.value);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:FloatValue.java

示例6: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(final DataOutputView out) throws IOException {
	synchronized (this.confData) {
		out.writeInt(this.confData.size());

		for (Map.Entry<String, Object> entry : this.confData.entrySet()) {
			String key = entry.getKey();
			Object val = entry.getValue();

			StringValue.writeString(key, out);
			Class<?> clazz = val.getClass();

			if (clazz == String.class) {
				out.write(TYPE_STRING);
				StringValue.writeString((String) val, out);
			}
			else if (clazz == Integer.class) {
				out.write(TYPE_INT);
				out.writeInt((Integer) val);
			}
			else if (clazz == Long.class) {
				out.write(TYPE_LONG);
				out.writeLong((Long) val);
			}
			else if (clazz == Float.class) {
				out.write(TYPE_FLOAT);
				out.writeFloat((Float) val);
			}
			else if (clazz == Double.class) {
				out.write(TYPE_DOUBLE);
				out.writeDouble((Double) val);
			}
			else if (clazz == byte[].class) {
				out.write(TYPE_BYTES);
				byte[] bytes = (byte[]) val;
				out.writeInt(bytes.length);
				out.write(bytes);
			}
			else if (clazz == Boolean.class) {
				out.write(TYPE_BOOLEAN);
				out.writeBoolean((Boolean) val);
			}
			else {
				throw new IllegalArgumentException("Unrecognized type");
			}
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:49,代码来源:Configuration.java


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