Java BufferedReader Read loadNumUsers(String fileName)

Here you can find the source of loadNumUsers(String fileName)

Description

load Num Users

License

Open Source License

Declaration

public static int[] loadNumUsers(String fileName) throws IOException 

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;

public class Main {
    public static int[] loadNumUsers(String fileName) throws IOException {
        File file = new File(fileName);
        FileReader fileReader = new FileReader(file);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        String line;/*from  www.  j av a  2s  . c o m*/
        try {
            if ((line = bufferedReader.readLine()) != null) {
                String[] tmp_res = line.split(" ");
                int[] res = new int[tmp_res.length];
                for (int i = 0; i < tmp_res.length; i++) {
                    res[i] = Integer.parseInt(tmp_res[i]);
                }
                bufferedReader.close();
                return res;
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;

    }
}

Related

  1. loadMetadata(File file)
  2. loadMetaFile(File metaFile)
  3. loadMimeTypes(Reader in, Map extMap, Map mimeMap)
  4. loadModel(String fileName, Hashtable dictionary, Hashtable> modelPairs)
  5. loadNameMap(String mapName, boolean reverseMap)
  6. loadPartitions(String fileName)
  7. loadPathPreferencesFromFile(File inputFile)
  8. loadPrivateKeyFile(File privateKeyFile)
  9. loadQueryFromFile(String queryFile)