Java Code Examples for org.apache.flink.core.memory.DataOutputView#writeLong()

The following examples show how to use org.apache.flink.core.memory.DataOutputView#writeLong() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void serialize(
	FlinkKafkaProducer.KafkaTransactionState record,
	DataOutputView target) throws IOException {
	if (record.transactionalId == null) {
		target.writeBoolean(false);
	} else {
		target.writeBoolean(true);
		target.writeUTF(record.transactionalId);
	}
	target.writeLong(record.producerId);
	target.writeShort(record.epoch);
}
 
Example 2
Source Project: flink   File: StreamElementSerializer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	int tag = source.readByte();
	target.write(tag);

	if (tag == TAG_REC_WITH_TIMESTAMP) {
		// move timestamp
		target.writeLong(source.readLong());
		typeSerializer.copy(source, target);
	}
	else if (tag == TAG_REC_WITHOUT_TIMESTAMP) {
		typeSerializer.copy(source, target);
	}
	else if (tag == TAG_WATERMARK) {
		target.writeLong(source.readLong());
	}
	else if (tag == TAG_STREAM_STATUS) {
		target.writeInt(source.readInt());
	}
	else if (tag == TAG_LATENCY_MARKER) {
		target.writeLong(source.readLong());
		target.writeLong(source.readLong());
		target.writeLong(source.readLong());
		target.writeInt(source.readInt());
	} else {
		throw new IOException("Corrupt stream, found tag: " + tag);
	}
}
 
Example 3
@Override
public void serialize(
		KafkaTransactionState record,
		DataOutputView target) throws IOException {
	if (record.transactionalId == null) {
		target.writeBoolean(false);
	} else {
		target.writeBoolean(true);
		target.writeUTF(record.transactionalId);
	}
	target.writeLong(record.producerId);
	target.writeShort(record.epoch);
}
 
Example 4
Source Project: flink   File: LongValueArray.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeInt(position);

	for (int i = 0; i < position; i++) {
		out.writeLong(data[i]);
	}
}
 
Example 5
Source Project: flink   File: LongValueArray.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeInt(position);

	for (int i = 0; i < position; i++) {
		out.writeLong(data[i]);
	}
}
 
Example 6
Source Project: flink   File: DecimalDataSerializer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	if (DecimalData.isCompact(precision)) {
		target.writeLong(source.readLong());
	} else {
		int len = source.readInt();
		target.writeInt(len);
		target.write(source, len);
	}
}
 
Example 7
Source Project: flink   File: DanglingPageRankITCase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeDouble(diff);
	out.writeDouble(rank);
	out.writeDouble(danglingRank);
	out.writeLong(numDanglingVertices);
	out.writeLong(numVertices);
	out.writeLong(edges);
}
 
Example 8
Source Project: flink   File: DanglingPageRankITCase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeDouble(diff);
	out.writeDouble(rank);
	out.writeDouble(danglingRank);
	out.writeLong(numDanglingVertices);
	out.writeLong(numVertices);
	out.writeLong(edges);
}
 
Example 9
Source Project: flink   File: ValueID.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeLong(id.getMostSignificantBits());
	out.writeLong(id.getLeastSignificantBits());
}
 
Example 10
Source Project: flink   File: CountWindow.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeLong(source.readLong());
}
 
Example 11
Source Project: Flink-CEPplus   File: EventId.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeInt(source.readInt());
	target.writeLong(source.readLong());
}
 
Example 12
Source Project: Flink-CEPplus   File: TimerSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeLong(source.readLong());
	keySerializer.copy(source, target);
	namespaceSerializer.copy(source, target);
}
 
Example 13
Source Project: flink   File: ValueID.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeLong(id.getMostSignificantBits());
	out.writeLong(id.getLeastSignificantBits());
}
 
Example 14
Source Project: Flink-CEPplus   File: EventId.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(EventId record, DataOutputView target) throws IOException {
	target.writeInt(record.id);
	target.writeLong(record.timestamp);
}
 
Example 15
Source Project: flink   File: CustomSerializationITCase.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	// write 8 bytes
	out.writeLong(42L);
}
 
Example 16
Source Project: flink   File: LongSerializer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(Long record, DataOutputView target) throws IOException {
	target.writeLong(record);
}
 
Example 17
Source Project: flink   File: BlockInfo.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeLong(this.recordCount);
	out.writeLong(this.accumulatedRecordCount);
	out.writeLong(this.firstRecordStart);
}
 
Example 18
Source Project: Flink-CEPplus   File: TestEvent.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeLong(magicNumber);
	out.writeInt(payload.length);
	out.write(payload);
}
 
Example 19
Source Project: Flink-CEPplus   File: Configuration.java    License: Apache License 2.0 4 votes vote down vote up
@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");
			}
		}
	}
}
 
Example 20
Source Project: flink   File: EventId.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeInt(source.readInt());
	target.writeLong(source.readLong());
}