Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static int skip(final InputStream is, final int n, final int bufferSize) throws IOException {
        int rd = 0;
        long ch = 0;
        while (rd < n && ch >= 0) {
            final long cn = (n - rd > bufferSize) ? bufferSize : (n - rd);
            ch = is.skip(cn);

            if (ch > 0) {
                rd += ch;
            }
        }
        return rd;
    }
}