1 16 17 package org.apache.axis.utils; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 22 25 public class IOUtils 26 { 27 private IOUtils() { 28 } 29 30 37 public static int readFully(InputStream in, byte[] b) 38 throws IOException  39 { 40 return readFully(in, b, 0, b.length); 41 } 42 43 50 public static int readFully(InputStream in, byte[] b, int off, int len) 51 throws IOException  52 { 53 int total = 0; 54 for (;;) { 55 int got = in.read(b, off + total, len - total); 56 if (got < 0) { 57 return (total == 0) ? -1 : total; 58 } else { 59 total += got; 60 if (total == len) 61 return total; 62 } 63 } 64 } 65 } | Popular Tags |