Java Code Examples for org.apache.flink.types.StringValue#copyString()
The following examples show how to use
org.apache.flink.types.StringValue#copyString() .
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: StringArraySerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { final int len = source.readInt(); target.writeInt(len); for (int i = 0; i < len; i++) { StringValue.copyString(source, target); } }
Example 2
Source File: StringSerializationTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static final void testCopy(String[] values) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); DataOutputStream serializer = new DataOutputStream(baos); for (String value : values) { StringValue.writeString(value, serializer); } serializer.close(); baos.close(); ByteArrayInputStream sourceInput = new ByteArrayInputStream(baos.toByteArray()); DataInputStream source = new DataInputStream(sourceInput); ByteArrayOutputStream targetOutput = new ByteArrayOutputStream(4096); DataOutputStream target = new DataOutputStream(targetOutput); for (int i = 0; i < values.length; i++) { StringValue.copyString(source, target); } ByteArrayInputStream validateInput = new ByteArrayInputStream(targetOutput.toByteArray()); DataInputStream validate = new DataInputStream(validateInput); int num = 0; while (validate.available() > 0) { String deser = StringValue.readString(validate); assertEquals("DeserializedString differs from original string.", values[num], deser); num++; } assertEquals("Wrong number of deserialized values", values.length, num); }
Example 3
Source File: NFAStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example 4
Source File: NodeId.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.writeByte(source.readByte()); eventIdSerializer.copy(source, target); StringValue.copyString(source, target); }
Example 5
Source File: StringArraySerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { final int len = source.readInt(); target.writeInt(len); for (int i = 0; i < len; i++) { StringValue.copyString(source, target); } }
Example 6
Source File: StringSerializationTest.java From flink with Apache License 2.0 | 5 votes |
public static final void testCopy(String[] values) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); DataOutputStream serializer = new DataOutputStream(baos); for (String value : values) { StringValue.writeString(value, serializer); } serializer.close(); baos.close(); ByteArrayInputStream sourceInput = new ByteArrayInputStream(baos.toByteArray()); DataInputStream source = new DataInputStream(sourceInput); ByteArrayOutputStream targetOutput = new ByteArrayOutputStream(4096); DataOutputStream target = new DataOutputStream(targetOutput); for (int i = 0; i < values.length; i++) { StringValue.copyString(source, target); } ByteArrayInputStream validateInput = new ByteArrayInputStream(targetOutput.toByteArray()); DataInputStream validate = new DataInputStream(validateInput); int num = 0; while (validate.available() > 0) { String deser = StringValue.readString(validate); assertEquals("DeserializedString differs from original string.", values[num], deser); num++; } assertEquals("Wrong number of deserialized values", values.length, num); }
Example 7
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example 8
Source File: NodeId.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.writeByte(source.readByte()); eventIdSerializer.copy(source, target); StringValue.copyString(source, target); }
Example 9
Source File: StringArraySerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { final int len = source.readInt(); target.writeInt(len); for (int i = 0; i < len; i++) { StringValue.copyString(source, target); } }
Example 10
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example 11
Source File: NodeId.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.writeByte(source.readByte()); eventIdSerializer.copy(source, target); StringValue.copyString(source, target); }
Example 12
Source File: StringSerializer.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); }
Example 13
Source File: StringSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); }
Example 14
Source File: StringSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); }