Remove compilation errors for MGC code with gc
[IRC.git] / Robust / src / ClassLibrary / SocketInputStream.java
index bc3a65ce04264afd5575c25b4bed56754236884d..807cab6df8408e8beb69a344ae84e48740c026e5 100644 (file)
@@ -16,6 +16,24 @@ public class SocketInputStream extends InputStream {
     return s.read(b);
   }
 
+  public int readAll(byte[] b) {
+    int offset=read(b);
+    if (offset<0)
+      return offset;
+    int toread=b.length-offset;
+    while(toread>0) {
+      byte[] t=new byte[toread];
+      int rd=read(t);
+      if (rd<0)
+       return rd;
+      for(int i=0; i<rd; i++)
+       b[i+offset]=t[i];
+      offset+=rd;
+      toread-=rd;
+    }
+    return b.length;
+  }
+
   public void close() {
     s.close();
   }