All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.rsocket.frame.FragmentationFlyweight Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package io.rsocket.frame;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import reactor.util.annotation.Nullable;

/** FragmentationFlyweight is used to re-assemble frames */
public class FragmentationFlyweight {
  public static ByteBuf encode(final ByteBufAllocator allocator, ByteBuf header, ByteBuf data) {
    return encode(allocator, header, null, data);
  }

  public static ByteBuf encode(
      final ByteBufAllocator allocator, ByteBuf header, @Nullable ByteBuf metadata, ByteBuf data) {
    if (metadata == null) {
      return DataAndMetadataFlyweight.encodeOnlyData(allocator, header, data);
    } else {
      return DataAndMetadataFlyweight.encode(allocator, header, metadata, data);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy