Java BufferedReader Read loadTXTList(String listFile, int size)

Here you can find the source of loadTXTList(String listFile, int size)

Description

load TXT List

License

Open Source License

Declaration

public static String[] loadTXTList(String listFile, int size) throws IOException 

Method Source Code


//package com.java2s;
/*/*from   ww w.  j  av a  2s .c om*/
 * #%L
 * G
 * %%
 * Copyright (C) 2014 Giovanni Stilo
 * %%
 * G is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program.  If not, see
 * <https://www.gnu.org/licenses/lgpl-3.0.txt>.
 * #L%
 */

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStreamReader;

import java.util.zip.GZIPInputStream;

public class Main {
    public static String[] loadTXTList(String listFile, int size) throws IOException {
        String[] list = new String[size];
        BufferedReader br = new BufferedReader(
                new InputStreamReader(new GZIPInputStream(new FileInputStream(listFile))));
        String line;
        int count = 0;

        while (count < size && (line = br.readLine()) != null) {
            list[count] = line;
            count++;
        }

        return list;
    }
}

Related

  1. loadToStringListFromFile(String fullFileName)
  2. loadTrustDistrustSets(String trust_data_set)
  3. loadTrustSet(String trustSet)
  4. loadTwoColumnResource(InputStream resource)
  5. loadTxnDescriptions(String filename)
  6. loadUnicodeStringFromFile(final File file)
  7. loadVocab(String vocabFilePath, double factor)
  8. loadWaypoints(File inFile)
  9. loadXML(String fileName)