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

The following examples show how to use org.apache.flink.core.memory.DataOutputView#writeShort() . 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
Source File: KeyedBackendSerializationProxy.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);

	// write the compression format used to write each key-group
	out.writeBoolean(usingKeyGroupCompression);

	TypeSerializerSnapshotSerializationUtil.writeSerializerSnapshot(out, keySerializerSnapshot, keySerializer);

	// write individual registered keyed state metainfos
	out.writeShort(stateMetaInfoSnapshots.size());
	for (StateMetaInfoSnapshot metaInfoSnapshot : stateMetaInfoSnapshots) {
		StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(metaInfoSnapshot, out);
	}
}
 
Example 2
Source File: ShortValueArray.java    From flink with 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.writeShort(data[i]);
	}
}
 
Example 3
Source File: LocalDateSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(LocalDate record, DataOutputView target) throws IOException {
	if (record == null) {
		target.writeInt(Integer.MIN_VALUE);
		target.writeShort(Short.MIN_VALUE);
	} else {
		target.writeInt(record.getYear());
		target.writeByte(record.getMonthValue());
		target.writeByte(record.getDayOfMonth());
	}
}
 
Example 4
Source File: FlinkKafkaProducer011.java    From flink with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: LocalTimeSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(LocalTime record, DataOutputView target) throws IOException {
	if (record == null) {
		target.writeByte(Byte.MIN_VALUE);
		target.writeShort(Short.MIN_VALUE);
		target.writeInt(Integer.MIN_VALUE);
	} else {
		target.writeByte(record.getHour());
		target.writeByte(record.getMinute());
		target.writeByte(record.getSecond());
		target.writeInt(record.getNano());
	}
}
 
Example 6
Source File: FlinkKafkaProducer011.java    From flink with Apache License 2.0 5 votes vote down vote up
@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 7
Source File: OperatorBackendSerializationProxy.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void writeStateMetaInfoSnapshots(
	List<StateMetaInfoSnapshot> snapshots,
	DataOutputView out) throws IOException {
	out.writeShort(snapshots.size());
	for (StateMetaInfoSnapshot state : snapshots) {
		StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(state, out);
	}
}
 
Example 8
Source File: ShortValueArray.java    From Flink-CEPplus with 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.writeShort(data[i]);
	}
}
 
Example 9
Source File: LocalTimeSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(LocalTime record, DataOutputView target) throws IOException {
	if (record == null) {
		target.writeByte(Byte.MIN_VALUE);
		target.writeShort(Short.MIN_VALUE);
		target.writeInt(Integer.MIN_VALUE);
	} else {
		target.writeByte(record.getHour());
		target.writeByte(record.getMinute());
		target.writeByte(record.getSecond());
		target.writeInt(record.getNano());
	}
}
 
Example 10
Source File: ShortValueArray.java    From flink with 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.writeShort(data[i]);
	}
}
 
Example 11
Source File: FlinkKafkaProducer011.java    From flink with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 12
Source File: OperatorBackendSerializationProxy.java    From flink with Apache License 2.0 5 votes vote down vote up
private void writeStateMetaInfoSnapshots(
	List<StateMetaInfoSnapshot> snapshots,
	DataOutputView out) throws IOException {
	out.writeShort(snapshots.size());
	for (StateMetaInfoSnapshot state : snapshots) {
		StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(state, out);
	}
}
 
Example 13
Source File: ShortPrimitiveArraySerializer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(short[] 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.writeShort(record[i]);
	}
}
 
Example 14
Source File: FlinkKafkaProducer011.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 15
Source File: LocalDateSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(LocalDate record, DataOutputView target) throws IOException {
	if (record == null) {
		target.writeInt(Integer.MIN_VALUE);
		target.writeShort(Short.MIN_VALUE);
	} else {
		target.writeInt(record.getYear());
		target.writeByte(record.getMonthValue());
		target.writeByte(record.getDayOfMonth());
	}
}
 
Example 16
Source File: OperatorBackendSerializationProxy.java    From flink with Apache License 2.0 5 votes vote down vote up
private void writeStateMetaInfoSnapshots(
	List<StateMetaInfoSnapshot> snapshots,
	DataOutputView out) throws IOException {
	out.writeShort(snapshots.size());
	for (StateMetaInfoSnapshot state : snapshots) {
		StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(state, out);
	}
}
 
Example 17
Source File: ShortType.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeShort(this.value);
}
 
Example 18
Source File: ShortValueSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeShort(source.readShort());
}
 
Example 19
Source File: UnsignedShortType.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutputView out) throws IOException {
	out.writeShort(this.value);
}
 
Example 20
Source File: ShortValueSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	target.writeShort(source.readShort());
}