Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.InputStream;

public class Main {
    public static int readSCSocketBytesFully(InputStream is, byte[] buffer, int len) throws Exception {
        int ret = 0, curRead = 0;

        while (true) {
            curRead = (len - ret);
            curRead = is.read(buffer, ret, curRead);
            ret += curRead;
            if (ret >= len) {
                break;
            }
            Thread.sleep(20);
        }
        return ret;
    }
}