diff --git a/spring-web/src/main/java/org/springframework/http/codec/protobuf/ProtobufDecoder.java b/spring-web/src/main/java/org/springframework/http/codec/protobuf/ProtobufDecoder.java index 157ba297cc..9d0db71396 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/protobuf/ProtobufDecoder.java +++ b/spring-web/src/main/java/org/springframework/http/codec/protobuf/ProtobufDecoder.java @@ -18,6 +18,7 @@ package org.springframework.http.codec.protobuf; import java.io.IOException; import java.lang.reflect.Method; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -42,25 +43,28 @@ import org.springframework.util.ConcurrentReferenceHashMap; import org.springframework.util.MimeType; /** - * A {@code Decoder} that reads {@link com.google.protobuf.Message}s - * using Google Protocol Buffers. + * A {@code Decoder} that reads {@link com.google.protobuf.Message}s using + * Google Protocol Buffers. * *
Flux deserialized via * {@link #decode(Publisher, ResolvableType, MimeType, Map)} are expected to use - * delimited Protobuf messages - * with the size of each message specified before the message itself. Single values deserialized - * via {@link #decodeToMono(Publisher, ResolvableType, MimeType, Map)} are expected to use - * regular Protobuf message format (without the size prepended before the message). + * + * delimited Protobuf messages with the size of each message specified before + * the message itself. Single values deserialized via + * {@link #decodeToMono(Publisher, ResolvableType, MimeType, Map)} are expected + * to use regular Protobuf message format (without the size prepended before + * the message). * - *
Notice that default instance of Protobuf message produces empty byte array, so - * {@code Mono.just(Msg.getDefaultInstance())} sent over the network will be deserialized - * as an empty {@link Mono}. + *
Notice that default instance of Protobuf message produces empty byte + * array, so {@code Mono.just(Msg.getDefaultInstance())} sent over the network + * will be deserialized as an empty {@link Mono}. * - *
To generate {@code Message} Java classes, you need to install the {@code protoc} binary. + *
To generate {@code Message} Java classes, you need to install the + * {@code protoc} binary. * *
This decoder requires Protobuf 3 or higher, and supports
- * {@code "application/x-protobuf"} and {@code "application/octet-stream"} with the official
- * {@code "com.google.protobuf:protobuf-java"} library.
+ * {@code "application/x-protobuf"} and {@code "application/octet-stream"} with
+ * the official {@code "com.google.protobuf:protobuf-java"} library.
*
* @author Sébastien Deleuze
* @since 5.1
@@ -68,9 +72,7 @@ import org.springframework.util.MimeType;
*/
public class ProtobufDecoder extends ProtobufCodecSupport implements Decoder