Java Code Examples for org.apache.flink.core.memory.DataInputView#readFloat()

The following examples show how to use org.apache.flink.core.memory.DataInputView#readFloat() . 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: FloatPrimitiveArraySerializer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public float[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	float[] result = new float[len];
	
	for (int i = 0; i < len; i++) {
		result[i] = source.readFloat();
	}
	
	return result;
}
 
Example 2
Source File: FloatComparator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	float l1 = firstSource.readFloat();
	float l2 = secondSource.readFloat();
	int comp = (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0)); 
	return ascendingComparison ? comp : -comp; 
}
 
Example 3
Source File: FloatValueArray.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	position = in.readInt();
	mark = 0;

	ensureCapacity(position);

	for (int i = 0; i < position; i++) {
		data[i] = in.readFloat();
	}
}
 
Example 4
Source File: FloatComparator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	float l1 = firstSource.readFloat();
	float l2 = secondSource.readFloat();
	int comp = (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0)); 
	return ascendingComparison ? comp : -comp; 
}
 
Example 5
Source File: FloatPrimitiveArraySerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public float[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	float[] result = new float[len];
	
	for (int i = 0; i < len; i++) {
		result[i] = source.readFloat();
	}
	
	return result;
}
 
Example 6
Source File: FloatPrimitiveArraySerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public float[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	float[] result = new float[len];
	
	for (int i = 0; i < len; i++) {
		result[i] = source.readFloat();
	}
	
	return result;
}
 
Example 7
Source File: FloatComparator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	float l1 = firstSource.readFloat();
	float l2 = secondSource.readFloat();
	int comp = (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0)); 
	return ascendingComparison ? comp : -comp; 
}
 
Example 8
Source File: FloatValueArray.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	position = in.readInt();
	mark = 0;

	ensureCapacity(position);

	for (int i = 0; i < position; i++) {
		data[i] = in.readFloat();
	}
}
 
Example 9
Source File: FloatType.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 10
Source File: Configuration.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	synchronized (this.confData) {
		final int numberOfProperties = in.readInt();

		for (int i = 0; i < numberOfProperties; i++) {
			String key = StringValue.readString(in);
			Object value;

			byte type = in.readByte();
			switch (type) {
				case TYPE_STRING:
					value = StringValue.readString(in);
					break;
				case TYPE_INT:
					value = in.readInt();
					break;
				case TYPE_LONG:
					value = in.readLong();
					break;
				case TYPE_FLOAT:
					value = in.readFloat();
					break;
				case TYPE_DOUBLE:
					value = in.readDouble();
					break;
				case TYPE_BOOLEAN:
					value = in.readBoolean();
					break;
				case TYPE_BYTES:
					byte[] bytes = new byte[in.readInt()];
					in.readFully(bytes);
					value = bytes;
					break;
				default:
					throw new IOException(String.format("Unrecognized type: %s. This method is deprecated and" +
						" might not work for all supported types.", type));
			}

			this.confData.put(key, value);
		}
	}
}
 
Example 11
Source File: FloatValue.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 12
Source File: FloatSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Float deserialize(DataInputView source) throws IOException {
	return source.readFloat();
}
 
Example 13
Source File: FloatType.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 14
Source File: Configuration.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	synchronized (this.confData) {
		final int numberOfProperties = in.readInt();

		for (int i = 0; i < numberOfProperties; i++) {
			String key = StringValue.readString(in);
			Object value;

			byte type = in.readByte();
			switch (type) {
				case TYPE_STRING:
					value = StringValue.readString(in);
					break;
				case TYPE_INT:
					value = in.readInt();
					break;
				case TYPE_LONG:
					value = in.readLong();
					break;
				case TYPE_FLOAT:
					value = in.readFloat();
					break;
				case TYPE_DOUBLE:
					value = in.readDouble();
					break;
				case TYPE_BOOLEAN:
					value = in.readBoolean();
					break;
				case TYPE_BYTES:
					byte[] bytes = new byte[in.readInt()];
					in.readFully(bytes);
					value = bytes;
					break;
				default:
					throw new IOException("Unrecognized type: " + type);
			}

			this.confData.put(key, value);
		}
	}
}
 
Example 15
Source File: FloatValue.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 16
Source File: FloatSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Float deserialize(DataInputView source) throws IOException {
	return source.readFloat();
}
 
Example 17
Source File: FloatType.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 18
Source File: Configuration.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	synchronized (this.confData) {
		final int numberOfProperties = in.readInt();

		for (int i = 0; i < numberOfProperties; i++) {
			String key = StringValue.readString(in);
			Object value;

			byte type = in.readByte();
			switch (type) {
				case TYPE_STRING:
					value = StringValue.readString(in);
					break;
				case TYPE_INT:
					value = in.readInt();
					break;
				case TYPE_LONG:
					value = in.readLong();
					break;
				case TYPE_FLOAT:
					value = in.readFloat();
					break;
				case TYPE_DOUBLE:
					value = in.readDouble();
					break;
				case TYPE_BOOLEAN:
					value = in.readBoolean();
					break;
				case TYPE_BYTES:
					byte[] bytes = new byte[in.readInt()];
					in.readFully(bytes);
					value = bytes;
					break;
				default:
					throw new IOException("Unrecognized type: " + type);
			}

			this.confData.put(key, value);
		}
	}
}
 
Example 19
Source File: FloatValue.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readFloat();
}
 
Example 20
Source File: FloatSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public Float deserialize(DataInputView source) throws IOException {
	return source.readFloat();
}