append part of java byte array to StringBuilder

后端 未结 3 1339
醉梦人生
醉梦人生 2021-02-18 22:01

How do I append a portion of byte array to a StringBuilder object under Java? I have a segment of a function that reads from an InputStream into a byte array. I then want to a

3条回答
  •  爱一瞬间的悲伤
    2021-02-18 22:26

    You could just create a String out of your buffer:

    String s = new String(buffer, 0, len);

    Then if you need to you can just append it to a StringBuilder.

提交回复
热议问题