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


Java DataOutputView.write方法代码示例

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


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

示例1: serializeCondition

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
private void serializeCondition(IterativeCondition<T> condition, DataOutputView out) throws IOException {
	out.writeBoolean(condition != null);
	if (condition != null) {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(baos);

		oos.writeObject(condition);

		oos.close();
		baos.close();

		byte[] serCondition = baos.toByteArray();
		out.writeInt(serCondition.length);
		out.write(serCondition);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:NFA.java

示例2: run

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void run() {
	try {
		for (int n = 0; n < NUM_ITERATIONS; n++) {
			DataOutputView writeEnd = backChannel.getWriteEnd();
			readInputFromDataChannel();
			Thread.sleep(random.nextInt(10));
			DataInputView inputView = Mockito.mock(DataInputView.class);
			actionLog.add("tail writes in iteration " + n);
			writeEnd.write(inputView, 1);
			backChannel.notifyOfEndOfSuperstep();
		}
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:BlockingBackChannelTest.java

示例3: write

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

	if (typeSerializer instanceof UnloadableDummyTypeSerializer) {
		UnloadableDummyTypeSerializer<T> dummyTypeSerializer =
			(UnloadableDummyTypeSerializer<T>) this.typeSerializer;

		byte[] serializerBytes = dummyTypeSerializer.getActualBytes();
		out.write(serializerBytes.length);
		out.write(serializerBytes);
	} else {
		// write in a way that allows the stream to recover from exceptions
		try (ByteArrayOutputStreamWithPos streamWithPos = new ByteArrayOutputStreamWithPos()) {
			InstantiationUtil.serializeObject(streamWithPos, typeSerializer);
			out.writeInt(streamWithPos.getPosition());
			out.write(streamWithPos.getBuf(), 0, streamWithPos.getPosition());
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:TypeSerializerSerializationUtil.java

示例4: write

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

	// write the length, variable-length encoded
	while (len >= HIGH_BIT) {
		out.write(len | HIGH_BIT);
		len >>>= 7;
	}
	out.write(len);

	// write the char data, variable length encoded
	for (int i = 0; i < this.len; i++) {
		int c = this.value[i];

		while (c >= HIGH_BIT) {
			out.write(c | HIGH_BIT);
			c >>>= 7;
		}
		out.write(c);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:StringValue.java

示例5: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	int val = source.readUnsignedByte();
	target.writeByte(val);
	
	if (val >= MAX_BIT) {
		int shift = 7;
		int curr;
		val = val & 0x7f;
		while ((curr = source.readUnsignedByte()) >= MAX_BIT) {
			target.writeByte(curr);
			val |= (curr & 0x7f) << shift;
			shift += 7;
		}
		target.writeByte(curr);
		val |= curr << shift;
	}
	
	target.write(source, val);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:Record.java

示例6: copyInternal

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
protected static void copyInternal(DataInputView source, DataOutputView target) throws IOException {
	int count = source.readInt();
	target.writeInt(count);

	int bytes = ELEMENT_LENGTH_IN_BYTES * count;
	target.write(source, bytes);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:DoubleValueArray.java

示例7: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	out.writeInt(val);
	out.writeBoolean(isLong);
	if (isLong) {
		out.write(BUFFER);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:ExternalSortLargeRecordsITCase.java

示例8: write

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

示例9: copy

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

示例10: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	byte[] bytes = new byte[32941];
	out.write(bytes);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:CustomSerializationITCase.java

示例11: copy

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

示例12: copy

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

示例13: write

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

示例14: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	final int len = source.readInt();
	target.writeInt(len);
	target.write(source, len * 4);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:FloatPrimitiveArraySerializer.java

示例15: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	final int len = source.readInt();
	target.writeInt(len);
	target.write(source, len * 8);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:DoublePrimitiveArraySerializer.java


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