rkhachatryan commented on a change in pull request #12120:
URL: https://github.com/apache/flink/pull/12120#discussion_r425605033



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/NonSpanningWrapper.java
##########
@@ -290,4 +309,49 @@ public int read(byte[] b, int off, int len) {
        public int read(byte[] b) {
                return read(b, 0, b.length);
        }
+
+       ByteBuffer wrapIntoByteBuffer() {
+               return segment.wrap(position, remaining());
+       }
+
+       int copyContentTo(byte[] dst) {
+               final int numBytesChunk = remaining();
+               segment.get(position, dst, 0, numBytesChunk);
+               return numBytesChunk;
+       }
+
+       /**
+        * Copies the data and transfers the "ownership" (i.e. clears current 
wrapper).
+        */
+       void transferTo(ByteBuffer dst) {
+               segment.get(position, dst, remaining());
+               clear();
+       }
+
+       Tuple2<DeserializationResult, Integer> getNextRecord(IOReadableWritable 
target) throws IOException {
+               int recordLen = readInt();
+               if (canReadRecord(recordLen)) {
+                       return readInto(target);
+               } else {
+                       return new Tuple2<>(PARTIAL_RECORD, recordLen);
+               }
+       }

Review comment:
       I'll create a POJO and will reuse the instance (it's a single thread).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to