CompositeMetadataCodec { public static byte decodeMimeIdFromMimeBuffer(ByteBuf mimeBuffer) { if (mimeBuffer.readableBytes() != 1) { return WellKnownMimeType.UNPARSEABLE_MIME_TYPE.getIdentifier(); } return (byte) (mimeBuffer.readByte() & STREAM_METADATA_LENGTH_MASK); } 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 decodeIdMinusTwoWhenMoreThanOneByte() { ByteBuf fakeIdBuffer = Unpooled.buffer(2); fakeIdBuffer.writeInt(200); assertThat(decodeMimeIdFromMimeBuffer(fakeIdBuffer)) .isEqualTo((WellKnownMimeType.UNPARSEABLE_MIME_TYPE.getIdentifier())); }
@Test void decodeIdMinusTwoWhenZeroByte() { ByteBuf fakeIdBuffer = Unpooled.buffer(0); assertThat(decodeMimeIdFromMimeBuffer(fakeIdBuffer)) .isEqualTo((WellKnownMimeType.UNPARSEABLE_MIME_TYPE.getIdentifier())); }