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;

public class Main {
    public static ArrayList<String> getBookmark(String extractPath, String md5) {
        ArrayList<String> listBookMark = new ArrayList<>();
        StringBuilder reval = new StringBuilder();
        try {
            InputStream in = new FileInputStream(extractPath + "/bookmark_" + 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();
        }
        String[] arrSite = reval.toString().split(";");
        for (String str : arrSite) {
            if (str.length() > 0) {
                listBookMark.add(str);
            }
        }
        return listBookMark;
    }
}