src/java.base/share/classes/java/net/Socket.java
branchniosocketimpl-branch
changeset 57164 ed6f6950c757
parent 57110 b848ca1ef778
child 57167 82874527373e
--- a/src/java.base/share/classes/java/net/Socket.java	Tue Feb 05 18:53:19 2019 +0000
+++ b/src/java.base/share/classes/java/net/Socket.java	Fri Feb 08 16:49:25 2019 +0000
@@ -934,7 +934,9 @@
         }
         @Override
         public int read() throws IOException {
-            return in.read();
+            byte[] a = new byte[1];
+            int n = read(a, 0, 1);
+            return (n > 0) ? (a[0] & 0xff) : -1;
         }
         @Override
         public int read(byte b[], int off, int len) throws IOException {
@@ -988,7 +990,8 @@
         }
         @Override
         public void write(int b) throws IOException {
-            out.write(b);
+            byte[] a = new byte[] { (byte) b };
+            write(a, 0, 1);
         }
         @Override
         public void write(byte b[], int off, int len) throws IOException {