Java BufferedReader Read loadEnrichmentHits(File file)

Here you can find the source of loadEnrichmentHits(File file)

Description

load Enrichment Hits

License

Open Source License

Declaration

public static Map<String, Integer> loadEnrichmentHits(File file) 

Method Source Code

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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static Map<String, Integer> loadEnrichmentHits(File file) {
        Map<String, Integer> ret = new HashMap();
        if (file == null) {
            return ret;
        }// ww w  .j  a  v a2  s . c o m

        try {
            BufferedReader r = null;
            try {
                r = new BufferedReader(new FileReader(file));

                String sLine;
                while ((sLine = r.readLine()) != null) {
                    String[] sa = sLine.trim().split(";");
                    if (sa.length < 2) {
                        continue;
                    }

                    try {
                        ret.put(sa[0], Integer.parseInt(sa[1]));
                    } catch (NumberFormatException e) {
                    }
                }
            } finally {
                if (r != null) {
                    r.close();
                }
            }
        } catch (IOException e) {
        }
        return ret;
    }
}

Related

  1. loadContents(File file)
  2. loadCredentials(File credentials)
  3. loadCsvFile(String fileWithPath, String delimiter)
  4. loadDataURLs(File f, Pattern p)
  5. loadDict(InputStream io, boolean case_sensitive)
  6. loadIgnorList()
  7. loadInputStream(InputStream inputStream)
  8. loadInt(BufferedReader br)
  9. loadIntegersFromFile(String filename)