OSDN Git Service

Fix slow read/write on iOS Net streams
authorJustin Shapcott <support@mobidevelop.com>
Sun, 18 Aug 2013 13:27:10 +0000 (06:27 -0700)
committerJustin Shapcott <support@mobidevelop.com>
Sun, 18 Aug 2013 13:27:10 +0000 (06:27 -0700)
Not sure why IOSNet has its own InputStream and OutputStream subclasses.
Should probably use the IOSStreamInput and IOSStreamOutput instead, but
this will do for now.

backends/gdx-backend-iosmonotouch/src/com/badlogic/gdx/backends/ios/IOSNet.java

index d1f34a6..bfa8e4c 100755 (executable)
@@ -58,6 +58,17 @@ public class IOSNet implements Net {
                public int read () throws IOException {\r
                        return stream.ReadByte();\r
                }\r
+               \r
+               @Override\r
+               public int read (byte[] b) throws IOException {\r
+                       return read(b, 0, b.length);\r
+               }\r
+\r
+               @Override\r
+               public int read (byte[] b, int off, int len) throws IOException {\r
+                       return stream.Read(b, off, len);\r
+               }\r
+               \r
        }\r
 \r
        public static class OutputStreamNetStreamImpl extends OutputStream {\r
@@ -74,6 +85,16 @@ public class IOSNet implements Net {
                        stream.WriteByte((byte)b);\r
                }\r
 \r
+               @Override\r
+               public void write (byte[] b) throws IOException {\r
+                       write(b, 0, b.length);\r
+               }\r
+\r
+               @Override\r
+               public void write (byte[] b, int off, int len) throws IOException {\r
+                       stream.Write(b, off, len);\r
+               }\r
+               \r
        }\r
 \r
        static class IosHttpResponse implements HttpResponse {\r