You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/10/18 06:01:44 UTC

[GitHub] [rocketmq-clients] MumfordSons opened a new issue, #262: Could MessageView provide a graceful method to get message body

MumfordSons opened a new issue, #262:
URL: https://github.com/apache/rocketmq-clients/issues/262

   now messageView.getBody()  returns a ByteBuffer object and can't directly get body byte array from ByteBuffer
   
   
   ![196329537-6fc05f7b-de85-4e72-a547-7bddda14e828](https://user-images.githubusercontent.com/45234194/196347996-95eeec2b-ca45-444d-af47-9aed6ff4d3ab.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai commented on issue #262: Could MessageView provide a graceful method to get message body

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on issue #262:
URL: https://github.com/apache/rocketmq-clients/issues/262#issuecomment-1281913560

   The underlying byte array of `bytebuffer` is readonly, which means you could not get it directly, so copy it from `bytebuffer` rather than get it directly if you need `byte[]`. 
   
   ```java
   byte[] bytes = new byte[body.remaining()];
   body.get(bytes);
   ```
   
   or you could easily get `String` type according to your type.
   
   ```java
   // Replace by your charset
   final String body = StandardCharsets.UTF_8.decode(messageView.getBody()).toString();
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai closed issue #262: Could MessageView provide a graceful method to get message body

Posted by GitBox <gi...@apache.org>.
aaron-ai closed issue #262: Could MessageView provide a graceful method to get message body
URL: https://github.com/apache/rocketmq-clients/issues/262


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org