I have a byte buffer from which i need to remove some bytes of carriage return /r and return the same byte buffer after removal. With help i was able to remove the the /r using stream as below but that return a int[], is there any way where i do not need to create another byte buffer and use the same one after removing the /r? Below is the code i used
IntStream.range(bb.position(), bb.limit())
.filter(i -> bb.get(i) != 13)
.map(i -> bb.get(i))
.toArray();
Let me know any other way to do this?