We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e84bbed commit 8306f1bCopy full SHA for 8306f1b
src/main/java/de/javasocketapi/core/ReadingByteBuffer.java
@@ -4,6 +4,7 @@
4
import java.nio.ByteBuffer;
5
import java.nio.charset.StandardCharsets;
6
import java.util.UUID;
7
+import java.util.stream.IntStream;
8
9
public class ReadingByteBuffer {
10
private final ByteBuffer byteBuffer;
@@ -57,9 +58,7 @@ public String readString() {
57
58
//read string
59
final int length = this.readInt();
60
final byte[] bytes = new byte[length];
- for (int i = 0; i < length; i++) {
61
- bytes[i] = this.readByte();
62
- }
+ IntStream.range(0, length).forEach(i -> bytes[i] = this.readByte());
63
return new String(bytes, StandardCharsets.UTF_8);
64
}
65
0 commit comments