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

The following examples show how to use org.apache.flink.core.memory.DataInputView#read() . 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: MigrationUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static void skipCondition(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);

		ois.readObject();
		ois.close();
		bais.close();
	}
}
 
Example 2
Source File: MigrationUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void skipCondition(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);

		ois.readObject();
		ois.close();
		bais.close();
	}
}
 
Example 3
Source File: RheemValue.java    From rheem with Apache License 2.0 6 votes vote down vote up
@Override
public void read(DataInputView dataInputView) throws IOException {

    int len = dataInputView.readUnsignedByte();

    if (len >= HIGH_BIT) {
        int shift = 7;
        int curr;
        len = len & 0x7f;
        while ((curr = dataInputView.readUnsignedByte()) >= HIGH_BIT) {
            len |= (curr & 0x7f) << shift;
            shift += 7;
        }
        len |= curr << shift;
    }

    byte[] array = new byte[len];

    dataInputView.read(array);

    this.data = convertToObject(array);
}
 
Example 4
Source File: MigrationUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void skipCondition(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);

		ois.readObject();
		ois.close();
		bais.close();
	}
}
 
Example 5
Source File: StringValueArray.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	length = in.readInt();
	position = in.readInt();

	markLength = 0;
	markPosition = 0;

	ensureCapacity(position);

	in.read(data, 0, position);
}
 
Example 6
Source File: StringValueArray.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	length = in.readInt();
	position = in.readInt();

	markLength = 0;
	markPosition = 0;

	ensureCapacity(position);

	in.read(data, 0, position);
}
 
Example 7
Source File: StringSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public String deserialize(DataInputView source) throws IOException {
	int len = source.readInt();
	byte[] bytes = new byte[len];
	source.read(bytes);
	return StringUtf8Utils.decodeUTF8(bytes, 0, len);
}
 
Example 8
Source File: StringSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	int len = source.readInt();
	target.writeInt(len);
	byte[] bytes = new byte[len];
	source.read(bytes);
	target.write(bytes);
}
 
Example 9
Source File: StringValueArray.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	length = in.readInt();
	position = in.readInt();

	markLength = 0;
	markPosition = 0;

	ensureCapacity(position);

	in.read(data, 0, position);
}