IOUtilspublic class IOUtils extends Object Utility class containing IO helper methods |
Constructors Summary |
---|
private IOUtils()
|
Methods Summary |
---|
public static int | readFully(java.io.InputStream in, byte[] b)Read into a byte array; tries to ensure that the the
full buffer is read.
Helper method, just calls readFully(in, b, 0, b.length)
return readFully(in, b, 0, b.length);
| public static int | readFully(java.io.InputStream in, byte[] b, int off, int len)Same as the normal in.read(b, off, len), but tries to ensure that
the entire len number of bytes is read.
int total = 0;
for (;;) {
int got = in.read(b, off + total, len - total);
if (got < 0) {
return (total == 0) ? -1 : total;
} else {
total += got;
if (total == len)
return total;
}
}
|
|