projects
/
IRC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7d54933
)
changes
author
jjenista
<jjenista>
Sat, 7 Mar 2009 00:45:35 +0000
(
00:45
+0000)
committer
jjenista
<jjenista>
Sat, 7 Mar 2009 00:45:35 +0000
(
00:45
+0000)
Robust/src/ClassLibrary/SocketInputStream.java
patch
|
blob
|
history
diff --git
a/Robust/src/ClassLibrary/SocketInputStream.java
b/Robust/src/ClassLibrary/SocketInputStream.java
index bc3a65ce04264afd5575c25b4bed56754236884d..f722272611507c723940d1a2efc76673611b6cb8 100644
(file)
--- a/
Robust/src/ClassLibrary/SocketInputStream.java
+++ b/
Robust/src/ClassLibrary/SocketInputStream.java
@@
-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();
}