类 ByteArrayEncoder

    • 方法详细资料

      • canEncode

        public boolean canEncode​(ResolvableType elementType,
                                 @Nullable
                                 MimeType mimeType)
        从接口复制的说明: Encoder
        Whether the encoder supports the given source element type and the MIME type for the output stream.
        指定者:
        canEncode 在接口中 Encoder<byte[]>
        覆盖:
        canEncode 在类中 AbstractEncoder<byte[]>
        参数:
        elementType - the type of elements in the source stream
        mimeType - the MIME type for the output stream (can be null if not specified)
        返回:
        true if supported, false otherwise
      • encodeValue

        public DataBuffer encodeValue​(byte[] bytes,
                                      DataBufferFactory bufferFactory,
                                      ResolvableType valueType,
                                      @Nullable
                                      MimeType mimeType,
                                      @Nullable
                                      Map<String,​Object> hints)
        从接口复制的说明: Encoder
        Encode an Object of type T to a data buffer. This is useful for scenarios, that distinct messages (or events) are encoded and handled individually, in fully aggregated form.

        By default this method raises UnsupportedOperationException and it is expected that some encoders cannot produce a single buffer or cannot do so synchronously (e.g. encoding a Resource).

        参数:
        bytes - the value to be encoded
        bufferFactory - for creating the output DataBuffer
        valueType - the type for the value being encoded
        mimeType - the MIME type for the output content (optional)
        hints - additional information about how to encode
        返回:
        the encoded content