Java Code Examples for org.apache.flink.core.memory.DataOutputView#write()
The following examples show how to use
org.apache.flink.core.memory.DataOutputView#write() .
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: Record.java From flink with Apache License 2.0 | 6 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { int val = source.readUnsignedByte(); target.writeByte(val); if (val >= MAX_BIT) { int shift = 7; int curr; val = val & 0x7f; while ((curr = source.readUnsignedByte()) >= MAX_BIT) { target.writeByte(curr); val |= (curr & 0x7f) << shift; shift += 7; } target.writeByte(curr); val |= curr << shift; } target.write(source, val); }
Example 2
Source File: StringValue.java From flink with Apache License 2.0 | 6 votes |
@Override public void write(final DataOutputView out) throws IOException { int len = this.len; // write the length, variable-length encoded while (len >= HIGH_BIT) { out.write(len | HIGH_BIT); len >>>= 7; } out.write(len); // write the char data, variable length encoded for (int i = 0; i < this.len; i++) { int c = this.value[i]; while (c >= HIGH_BIT) { out.write(c | HIGH_BIT); c >>>= 7; } out.write(c); } }
Example 3
Source File: VoidNamespaceSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public void serialize(VoidNamespace record, DataOutputView target) throws IOException { // Make progress in the stream, write one byte. // // We could just skip writing anything here, because of the way this is // used with the state backends, but if it is ever used somewhere else // (even though it is unlikely to happen), it would be a problem. target.write(0); }
Example 4
Source File: DecimalSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { if (Decimal.isCompact(precision)) { target.writeLong(source.readLong()); } else { int len = source.readInt(); target.writeInt(len); target.write(source, len); } }
Example 5
Source File: IntValueArray.java From flink with Apache License 2.0 | 5 votes |
protected static void copyInternal(DataInputView source, DataOutputView target) throws IOException { int count = source.readInt(); target.writeInt(count); int bytes = ELEMENT_LENGTH_IN_BYTES * count; target.write(source, bytes); }
Example 6
Source File: ExternalSortLargeRecordsITCase.java From flink with Apache License 2.0 | 5 votes |
@Override public void write(DataOutputView out) throws IOException { out.writeInt(val); out.writeInt(size); for (int i = 0; i < size; i++) { out.write((byte) (i)); } }
Example 7
Source File: VoidNamespaceSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public void serialize(VoidNamespace record, DataOutputView target) throws IOException { // Make progress in the stream, write one byte. // // We could just skip writing anything here, because of the way this is // used with the state backends, but if it is ever used somewhere else // (even though it is unlikely to happen), it would be a problem. target.write(0); }
Example 8
Source File: BigIntSerializer.java From flink with Apache License 2.0 | 5 votes |
public static boolean copyBigInteger(DataInputView source, DataOutputView target) throws IOException { final int len = source.readInt(); target.writeInt(len); if (len > 4) { target.write(source, len - 4); } return len == 0; // returns true if the copied record was null }
Example 9
Source File: ExternalSortLargeRecordsITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void write(DataOutputView out) throws IOException { out.writeInt(val); out.writeInt(size); for (int i = 0; i < size; i++) { out.write((byte) (i)); } }
Example 10
Source File: StringSerializer.java From flink with Apache License 2.0 | 5 votes |
@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 11
Source File: BinaryRowDataSerializer.java From flink with Apache License 2.0 | 5 votes |
/** * Copy a binaryRow which stored in paged input view to output view. * * @param source source paged input view where the binary row stored * @param target the target output view. */ public void copyFromPagesToView( AbstractPagedInputView source, DataOutputView target) throws IOException { checkSkipReadForFixLengthPart(source); int length = source.readInt(); target.writeInt(length); target.write(source, length); }
Example 12
Source File: InternalTimersSnapshotReaderWriters.java From flink with Apache License 2.0 | 5 votes |
@Override protected void writeKeyAndNamespaceSerializers(DataOutputView out) throws IOException { // the pre-versioned format only serializes the serializers, without their configuration snapshots try (ByteArrayOutputStreamWithPos stream = new ByteArrayOutputStreamWithPos()) { InstantiationUtil.serializeObject(stream, keySerializer); InstantiationUtil.serializeObject(stream, namespaceSerializer); out.write(stream.getBuf(), 0, stream.getPosition()); } }
Example 13
Source File: ShortValueArray.java From flink with Apache License 2.0 | 5 votes |
protected static void copyInternal(DataInputView source, DataOutputView target) throws IOException { int count = source.readInt(); target.writeInt(count); int bytes = ELEMENT_LENGTH_IN_BYTES * count; target.write(source, bytes); }
Example 14
Source File: BytePrimitiveArraySerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { final int len = source.readInt(); target.writeInt(len); target.write(source, len); }
Example 15
Source File: CopyOnWriteSkipListStateMapSnapshot.java From flink with Apache License 2.0 | 4 votes |
/** * Write value from bytes. */ private void writeValue(long valuePointer, DataOutputView outputView) throws IOException { outputView.write(owningStateMap.helpGetBytesForState(valuePointer)); }
Example 16
Source File: RecordWriterTest.java From flink with Apache License 2.0 | 4 votes |
@Override public void write(DataOutputView out) throws IOException { out.write(bytes); }
Example 17
Source File: VoidSerializer.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void serialize(Void record, DataOutputView target) throws IOException { // make progress in the stream, write one byte target.write(0); }
Example 18
Source File: DoubleValue.java From flink with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.write(source, 8); }
Example 19
Source File: PostVersionedIOReadableWritable.java From flink with Apache License 2.0 | 4 votes |
@Override public void write(DataOutputView out) throws IOException { out.write(VERSIONED_IDENTIFIER); super.write(out); }
Example 20
Source File: ByteArrayType.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void write(DataOutputView out) throws IOException { out.writeInt(this.data.length); out.write(this.data); }