Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import android.util.Log;

public class Main {
    static String tag = "FileUtilsDonggu";

    public static String isFileDownloaded(String filename, int contentlen) {

        Log.i(tag, "filename:" + filename);
        Log.i(tag, "len:" + contentlen);
        File f = new File(filename);

        if (!f.exists()) {
            return "init";
        }
        Log.i(tag, "f.length():" + f.length());

        if (f.length() < contentlen) {
            return "downloading";
        }

        if (f.length() == contentlen) {
            return "finished";
        }

        return "error";

    }
}