File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/de/javasocketapi/core Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 11package de .javasocketapi .core ;
22
33import java .nio .ByteBuffer ;
4+ import java .util .Arrays ;
45import java .util .UUID ;
56
67public class ReadingByteBuffer {
@@ -52,9 +53,9 @@ public char readChar() {
5253
5354 public String readString () {
5455 //read string
55- int lenght = this .readInt ();
56- byte [] bytes = new byte [lenght ];
57- for (int i = 0 ; i < lenght ; i ++) {
56+ int length = this .readInt ();
57+ byte [] bytes = new byte [length ];
58+ for (int i = 0 ; i < length ; i ++) {
5859 bytes [i ] = this .readByte ();
5960 }
6061 return new String (bytes );
Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ public void writeString(final String value) {
5555 //check value
5656 checkInput (value );
5757 //writing string
58- int length = value .length ();
59- this .writeInt (length );
60- for (byte b : value . getBytes () ) {
58+ byte [] bytes = value .getBytes ();
59+ this .writeInt (bytes . length );
60+ for (byte b : bytes ) {
6161 this .writeByte (b );
6262 }
6363 }
You can’t perform that action at this time.
0 commit comments