本文整理汇总了Java中org.apache.flink.core.memory.DataInputView.readBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputView.readBoolean方法的具体用法?Java DataInputView.readBoolean怎么用?Java DataInputView.readBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.core.memory.DataInputView
的用法示例。
在下文中一共展示了DataInputView.readBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
final int size = source.readInt();
target.writeInt(size);
for (int i = 0; i < size; ++i) {
keySerializer.copy(source, target);
boolean isNull = source.readBoolean();
target.writeBoolean(isNull);
if (!isNull) {
valueSerializer.copy(source, target);
}
}
}
示例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);
}
}
示例3: deserialize
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public Map<K, V> deserialize(DataInputView source) throws IOException {
final int size = source.readInt();
final Map<K, V> map = new HashMap<>(size);
for (int i = 0; i < size; ++i) {
K key = keySerializer.deserialize(source);
boolean isNull = source.readBoolean();
V value = isNull ? null : valueSerializer.deserialize(source);
map.put(key, value);
}
return map;
}
示例4: deserializeCondition
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
private IterativeCondition<T> deserializeCondition(DataInputView in) throws IOException, ClassNotFoundException {
boolean hasCondition = in.readBoolean();
if (hasCondition) {
int length = in.readInt();
byte[] serCondition = new byte[length];
in.read(serCondition);
ByteArrayInputStream bais = new ByteArrayInputStream(serCondition);
ObjectInputStream ois = new ObjectInputStream(bais);
IterativeCondition<T> condition = (IterativeCondition<T>) ois.readObject();
ois.close();
bais.close();
return condition;
}
return null;
}
示例5: deserialize
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public HashMap<K, V> deserialize(DataInputView source) throws IOException {
final int size = source.readInt();
final HashMap<K, V> map = new HashMap<>(size);
for (int i = 0; i < size; ++i) {
K key = keySerializer.deserialize(source);
boolean isNull = source.readBoolean();
V value = isNull ? null : valueSerializer.deserialize(source);
map.put(key, value);
}
return map;
}
示例6: 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);
}
示例7: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(
DataInputView source, DataOutputView target) throws IOException {
boolean hasTransactionalId = source.readBoolean();
target.writeBoolean(hasTransactionalId);
if (hasTransactionalId) {
target.writeUTF(source.readUTF());
}
target.writeLong(source.readLong());
target.writeShort(source.readShort());
}
示例8: read
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void read(DataInputView in) throws IOException {
super.read(in);
final int readVersion = getReadVersion();
if (readVersion >= 4) {
usingKeyGroupCompression = in.readBoolean();
} else {
usingKeyGroupCompression = false;
}
// only starting from version 3, we have the key serializer and its config snapshot written
if (readVersion >= 3) {
Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot> keySerializerAndConfig =
TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, userCodeClassLoader).get(0);
this.keySerializer = (TypeSerializer<K>) keySerializerAndConfig.f0;
this.keySerializerConfigSnapshot = keySerializerAndConfig.f1;
} else {
this.keySerializer = TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader);
this.keySerializerConfigSnapshot = null;
}
int numKvStates = in.readShort();
stateMetaInfoSnapshots = new ArrayList<>(numKvStates);
for (int i = 0; i < numKvStates; i++) {
stateMetaInfoSnapshots.add(
KeyedBackendStateMetaInfoSnapshotReaderWriters
.getReaderForVersion(getReadVersion(), userCodeClassLoader)
.readStateMetaInfo(in));
}
}
示例9: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
boolean isLeft = source.readBoolean();
target.writeBoolean(isLeft);
if (isLeft) {
leftSerializer.copy(source, target);
}
else {
rightSerializer.copy(source, target);
}
}
示例10: compareSerialized
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
final int fs = firstSource.readBoolean() ? 1 : 0;
final int ss = secondSource.readBoolean() ? 1 : 0;
int comp = fs - ss;
return ascendingComparison ? comp : -comp;
}
示例11: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
int len = source.readInt();
target.writeInt(len);
for (int i = 0; i < len; i++) {
boolean isNonNull = source.readBoolean();
target.writeBoolean(isNonNull);
if (isNonNull) {
componentSerializer.copy(source, target);
}
}
}
示例12: deserialize
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
/**
* Deserializes an object from the input view.
*
* <p>First it reads a boolean indicating whether a reference handle or a serialized object
* follows.
*
* @param source The input view from which to read the data.
* @return The deserialized object
* @throws IOException
*/
public T deserialize(DataInputView source) throws IOException {
boolean alreadyRead = source.readBoolean();
if (alreadyRead) {
int index = source.readInt();
return elementList.get(index);
} else {
T element = typeSerializer.deserialize(source);
elementList.add(element);
return element;
}
}
示例13: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
boolean alreadyRead = source.readBoolean();
if (alreadyRead) {
int index = source.readInt();
typeSerializer.serialize(elementList.get(index), target);
} else {
T element = typeSerializer.deserialize(source);
typeSerializer.serialize(element, target);
}
}
示例14: copy
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
// copy the flags
int flags = source.readByte();
target.writeByte(flags);
if ((flags & IS_NULL) != 0) {
// is a null value, nothing further to copy
return;
}
TypeSerializer<?> subclassSerializer = null;
if ((flags & IS_SUBCLASS) != 0) {
String className = source.readUTF();
target.writeUTF(className);
try {
Class<?> subclass = Class.forName(className, true, Thread.currentThread()
.getContextClassLoader());
subclassSerializer = getSubclassSerializer(subclass);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot instantiate class.", e);
}
} else if ((flags & IS_TAGGED_SUBCLASS) != 0) {
int subclassTag = source.readByte();
target.writeByte(subclassTag);
subclassSerializer = registeredSerializers[subclassTag];
}
if ((flags & NO_SUBCLASS) != 0) {
for (int i = 0; i < numFields; i++) {
boolean isNull = source.readBoolean();
target.writeBoolean(isNull);
if (!isNull) {
fieldSerializers[i].copy(source, target);
}
}
} else {
if (subclassSerializer != null) {
subclassSerializer.copy(source, target);
}
}
}
示例15: read
import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public void read(DataInputView in) throws IOException {
in.readBoolean();
}