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


Java DataInputView.readLong方法代码示例

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


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

示例1: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public State<TXN, CONTEXT> deserialize(DataInputView source) throws IOException {
	TXN pendingTxnHandle = transactionSerializer.deserialize(source);
	final long pendingTxnStartTime = source.readLong();
	final TransactionHolder<TXN> pendingTxn = new TransactionHolder<>(
		pendingTxnHandle,
		pendingTxnStartTime);

	int numPendingCommitTxns = source.readInt();
	List<TransactionHolder<TXN>> pendingCommitTxns = new ArrayList<>(numPendingCommitTxns);
	for (int i = 0; i < numPendingCommitTxns; i++) {
		final TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source);
		final long pendingCommitTxnStartTime = source.readLong();
		pendingCommitTxns.add(new TransactionHolder<>(
			pendingCommitTxnHandle,
			pendingCommitTxnStartTime));
	}

	Optional<CONTEXT> context = Optional.empty();
	boolean hasContext = source.readBoolean();
	if (hasContext) {
		context = Optional.of(contextSerializer.deserialize(source));
	}

	return new State<>(pendingTxn, pendingCommitTxns, context);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:TwoPhaseCommitSinkFunction.java

示例2: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(
		DataInputView source, DataOutputView target) throws IOException {
	TXN pendingTxnHandle = transactionSerializer.deserialize(source);
	transactionSerializer.serialize(pendingTxnHandle, target);
	final long pendingTxnStartTime = source.readLong();
	target.writeLong(pendingTxnStartTime);

	int numPendingCommitTxns = source.readInt();
	target.writeInt(numPendingCommitTxns);
	for (int i = 0; i < numPendingCommitTxns; i++) {
		TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source);
		transactionSerializer.serialize(pendingCommitTxnHandle, target);
		final long pendingCommitTxnStartTime = source.readLong();
		target.writeLong(pendingCommitTxnStartTime);
	}

	boolean hasContext = source.readBoolean();
	target.writeBoolean(hasContext);
	if (hasContext) {
		CONTEXT context = contextSerializer.deserialize(source);
		contextSerializer.serialize(context, target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:TwoPhaseCommitSinkFunction.java

示例3: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public StreamElement deserialize(DataInputView source) throws IOException {
	int tag = source.readByte();
	if (tag == TAG_REC_WITH_TIMESTAMP) {
		long timestamp = source.readLong();
		return new StreamRecord<T>(typeSerializer.deserialize(source), timestamp);
	}
	else if (tag == TAG_REC_WITHOUT_TIMESTAMP) {
		return new StreamRecord<T>(typeSerializer.deserialize(source));
	}
	else if (tag == TAG_WATERMARK) {
		return new Watermark(source.readLong());
	}
	else {
		throw new IOException("Corrupt stream, found tag: " + tag);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:MultiplexingStreamRecordSerializer.java

示例4: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public KafkaTransactionState deserialize(DataInputView source) throws IOException {
	String transactionalId = null;
	if (source.readBoolean()) {
		transactionalId = source.readUTF();
	}
	long producerId = source.readLong();
	short epoch = source.readShort();
	return new KafkaTransactionState(transactionalId, producerId, epoch, null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:FlinkKafkaProducer011.java

示例5: compareSerialized

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	long l1 = firstSource.readLong();
	long l2 = secondSource.readLong();
	int comp = (l1 < l2 ? -1 : (l1 == l2 ? 0 : 1)); 
	return ascendingComparison ? comp : -comp;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:LongComparator.java

示例6: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public long[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	long[] array = new long[len];
	
	for (int i = 0; i < len; i++) {
		array[i] = source.readLong();
	}
	
	return array;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:LongPrimitiveArraySerializer.java

示例7: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public Time deserialize(DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	} else {
		return new Time(v);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SqlTimeSerializer.java

示例8: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public Date deserialize(DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	} else {
		return new Date(v);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SqlDateSerializer.java

示例9: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public Timestamp deserialize(DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	} else {
		final Timestamp t = new Timestamp(v);
		t.setNanos(source.readInt());
		return t;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:SqlTimestampSerializer.java

示例10: read

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

示例11: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	Set<State<T>> states = deserializeStates(source);
	serializeStates(states, target);

	long windowTime = source.readLong();
	target.writeLong(windowTime);

	boolean handleTimeout = source.readBoolean();
	target.writeBoolean(handleTimeout);

	SharedBuffer<String, T> sharedBuffer = sharedBufferSerializer.deserialize(source);
	sharedBufferSerializer.serialize(sharedBuffer, target);

	StringSerializer stateNameSerializer = StringSerializer.INSTANCE;
	LongSerializer timestampSerializer = LongSerializer.INSTANCE;
	DeweyNumber.DeweyNumberSerializer versionSerializer = new DeweyNumber.DeweyNumberSerializer();

	int computationStateNo = source.readInt();
	target.writeInt(computationStateNo);

	for (int i = 0; i < computationStateNo; i++) {
		String stateName = stateNameSerializer.deserialize(source);
		stateNameSerializer.serialize(stateName, target);

		String prevStateName = stateNameSerializer.deserialize(source);
		stateNameSerializer.serialize(prevStateName, target);

		long timestamp = timestampSerializer.deserialize(source);
		timestampSerializer.serialize(timestamp, target);

		DeweyNumber version = versionSerializer.deserialize(source);
		versionSerializer.serialize(version, target);

		long startTimestamp = timestampSerializer.deserialize(source);
		timestampSerializer.serialize(startTimestamp, target);

		int counter = source.readInt();
		target.writeInt(counter);

		boolean hasEvent = source.readBoolean();
		target.writeBoolean(hasEvent);
		if (hasEvent) {
			T event = eventSerializer.deserialize(source);
			eventSerializer.serialize(event, target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:49,代码来源:NFA.java

示例12: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public TimeWindow deserialize(DataInputView source) throws IOException {
	long start = source.readLong();
	long end = source.readLong();
	return new TimeWindow(start, end);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:TimeWindow.java

示例13: read

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

示例14: read

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

示例15: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public SharedBuffer<K, V> deserialize(DataInputView source) throws IOException {
	List<SharedBufferEntry<K, V>> entryList = new ArrayList<>();
	Map<K, SharedBufferPage<K, V>> pages = new HashMap<>();

	int totalPages = source.readInt();

	for (int i = 0; i < totalPages; i++) {
		// key of the page
		@SuppressWarnings("unchecked")
		K key = keySerializer.deserialize(source);

		SharedBufferPage<K, V> page = new SharedBufferPage<>(key);

		pages.put(key, page);

		int numberEntries = source.readInt();

		for (int j = 0; j < numberEntries; j++) {
			// restore the SharedBufferEntries for the given page
			V value = valueSerializer.deserialize(source);
			long timestamp = source.readLong();
			int counter = source.readInt();

			ValueTimeWrapper<V> valueTimeWrapper = new ValueTimeWrapper<>(value, timestamp, counter);
			SharedBufferEntry<K, V> sharedBufferEntry = new SharedBufferEntry<K, V>(valueTimeWrapper, page);

			sharedBufferEntry.referenceCounter = source.readInt();

			page.entries.put(valueTimeWrapper, sharedBufferEntry);

			entryList.add(sharedBufferEntry);
		}
	}

	// read the edges of the shared buffer entries
	int totalEdges = source.readInt();

	for (int j = 0; j < totalEdges; j++) {
		int sourceIndex = source.readInt();
		Preconditions.checkState(sourceIndex < entryList.size() && sourceIndex >= 0,
				"Could not find source entry with index " + sourceIndex + 	". This indicates a corrupted state.");

		int targetIndex = source.readInt();
		Preconditions.checkState(targetIndex < entryList.size(),
				"Could not find target entry with index " + sourceIndex + 	". This indicates a corrupted state.");

		DeweyNumber version = versionSerializer.deserialize(source);

		// We've already deserialized the shared buffer entry. Simply read its ID and
		// retrieve the buffer entry from the list of entries
		SharedBufferEntry<K, V> sourceEntry = entryList.get(sourceIndex);
		SharedBufferEntry<K, V> targetEntry = targetIndex < 0 ? null : entryList.get(targetIndex);

		sourceEntry.edges.add(new SharedBufferEdge<>(targetEntry, version));
	}
	// here we put the old NonDuplicating serializer because this needs to create a copy
	// of the buffer, as created by the NFA. There, for compatibility reasons, we have left
	// the old serializer.
	return new SharedBuffer<>(new NonDuplicatingTypeSerializer<>(valueSerializer), pages);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:62,代码来源:SharedBuffer.java


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