| 106 | } |
| 107 | |
| 108 | public void readFully(byte b[], int off, int len) throws IOException { |
| 109 | if(b == null) |
| 110 | throw new IllegalArgumentException(); |
| 111 | if (peer == 0) |
| 112 | throw new IOException(); |
| 113 | if(len == 0) |
| 114 | return; |
| 115 | if (position + len > this.length) |
| 116 | throw new EOFException(); |
| 117 | if (off < 0 || off + len > b.length) |
| 118 | throw new ArrayIndexOutOfBoundsException(); |
| 119 | int n = 0; |
| 120 | do { |
| 121 | int count = readBytes(peer, position, b, off + n, len - n); |
| 122 | position += count; |
| 123 | if (count == 0) |
| 124 | throw new EOFException(); |
| 125 | n += count; |
| 126 | } while (n < len); |
| 127 | } |
| 128 | |
| 129 | public void readFully(byte b[]) throws IOException { |
| 130 | readFully(b, 0, b.length); |