Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.FileInputStream;

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

import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static ArrayList<String> getListSite(String extractPath, String md5) {
        ArrayList<String> listSite = new ArrayList<>();

        StringBuilder reval = new StringBuilder();
        try {
            InputStream in = new FileInputStream(extractPath + "/site_map_" + md5);
            byte[] buf = new byte[1024];
            int c = 0;
            while ((c = in.read(buf)) >= 0) {
                reval.append(new String(buf, 0, c));
            }
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
        String[] arrSite = reval.toString().split(";");
        Collections.addAll(listSite, arrSite);
        return listSite;
    }
}