File tree Expand file tree Collapse file tree 4 files changed +7
-4
lines changed
src/de/javasocketapi/core Expand file tree Collapse file tree 4 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public void connect() throws IOException {
4141 this .socket = new Socket (this .hostname , this .port );
4242 this .socket .setTcpNoDelay (true );
4343 this .socket .setKeepAlive (true );
44- this .socket .setPerformancePreferences (0 , 1 , 2 );
44+ // this.socket.setPerformancePreferences(0, 1, 2);
4545 }
4646 //start reading and writing
4747 this .inputStreamThread = new InputStreamThread (this );
Original file line number Diff line number Diff line change 11package de .javasocketapi .core ;
22
33import java .nio .ByteBuffer ;
4+ import java .nio .charset .StandardCharsets ;
45import java .util .UUID ;
56
67public class ReadingByteBuffer {
@@ -17,6 +18,7 @@ public boolean readBoolean() {
1718
1819 public byte readByte () {
1920 //read byte
21+
2022 return this .byteBuffer .get ();
2123 }
2224
@@ -57,7 +59,7 @@ public String readString() {
5759 for (int i = 0 ; i < length ; i ++) {
5860 bytes [i ] = this .readByte ();
5961 }
60- return new String (bytes );
62+ return new String (bytes , StandardCharsets . UTF_8 );
6163 }
6264
6365 public UUID readUUID () {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public void connect() throws IOException {
2525 if (this .serverSocket == null ) {
2626 //initialise serverSocket
2727 this .serverSocket = new ServerSocket (this .port );
28- this .serverSocket .setPerformancePreferences (0 , 1 , 2 );
28+ // this.serverSocket.setPerformancePreferences(0, 1, 2);
2929 }
3030 //start accepting clients
3131 this .serverSocketAcceptingThread = new ServerSocketAcceptingThread (this .serverSocket );
Original file line number Diff line number Diff line change 22
33import org .boon .primitive .ByteBuf ;
44
5+ import java .nio .charset .StandardCharsets ;
56import java .util .UUID ;
67
78public class WritingByteBuffer {
@@ -55,7 +56,7 @@ public void writeString(final String value) {
5556 //check value
5657 WritingByteBuffer .checkInput (value );
5758 //writing string
58- final byte [] bytes = value .getBytes ();
59+ final byte [] bytes = value .getBytes (StandardCharsets . UTF_8 );
5960 this .writeInt (bytes .length );
6061 for (final byte b : bytes ) {
6162 this .writeByte (b );
You can’t perform that action at this time.
0 commit comments