public static int readStream(InputStream is, byte[] buff, int off, int len) throws
            IOException {
        if(off+len > buff.length){
            throw new IOException("off+len > buff.lengthB͈͂B");
        }
        int total_size = 0;
        int size = 0;
        while (total_size < len &&
               (size = is.read(buff, off+total_size, len - total_size)) > 0) {
            total_size += size;
        }
        return total_size;
    }