将两个byteBuffer连接到一个 [英] concatenate two byteBuffers to a single

查看:481
本文介绍了将两个byteBuffer连接到一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有2个byteBuffer,我想将它们连接到一个byteBuffer中。
我在这里找到了类似的问题,但是那里没有任何建议对我有用。

Hi I've 2 byteBuffers and I want to concatenate them together to a single byteBuffer. I found a similar question here but none of the suggestions there worked for me.

推荐答案

您可以这样做这

    ByteBuffer b3 = ByteBuffer.allocate(b1.limit() + b2.limit());
    b3.put(b1);
    b3.put(b2);

这篇关于将两个byteBuffer连接到一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆