CompositeMetadataCodec { public static boolean hasEntry(ByteBuf compositeMetadata, int entryIndex) { return compositeMetadata.writerIndex() - entryIndex > 0; } private  CompositeMetadataCodec(); static int computeNextEntryIndex(
      int currentEntryIndex, ByteBuf headerSlice, ByteBuf contentSlice); static ByteBuf[] decodeMimeAndContentBuffersSlices(
      ByteBuf compositeMetadata, int entryIndex, boolean retainSlices); static byte decodeMimeIdFromMimeBuffer(ByteBuf mimeBuffer); @Nullable static CharSequence decodeMimeTypeFromMimeBuffer(ByteBuf flyweightMimeBuffer); static void encodeAndAddMetadata(
      CompositeByteBuf compositeMetaData,
      ByteBufAllocator allocator,
      String customMimeType,
      ByteBuf metadata); static void encodeAndAddMetadata(
      CompositeByteBuf compositeMetaData,
      ByteBufAllocator allocator,
      WellKnownMimeType knownMimeType,
      ByteBuf metadata); static void encodeAndAddMetadataWithCompression(
      CompositeByteBuf compositeMetaData,
      ByteBufAllocator allocator,
      String mimeType,
      ByteBuf metadata); static boolean hasEntry(ByteBuf compositeMetadata, int entryIndex); static boolean isWellKnownMimeType(ByteBuf header);  }
@Test void hasEntry() { WellKnownMimeType mime = WellKnownMimeType.APPLICATION_AVRO; CompositeByteBuf buffer = Unpooled.compositeBuffer() .addComponent( true, CompositeMetadataCodec.encodeMetadataHeader( ByteBufAllocator.DEFAULT, mime.getIdentifier(), 0)) .addComponent( true, CompositeMetadataCodec.encodeMetadataHeader( ByteBufAllocator.DEFAULT, mime.getIdentifier(), 0)); assertThat(CompositeMetadataCodec.hasEntry(buffer, 0)).isTrue(); assertThat(CompositeMetadataCodec.hasEntry(buffer, 4)).isTrue(); assertThat(CompositeMetadataCodec.hasEntry(buffer, 8)).isFalse(); }