Here you can find the source of loadTXTList(String listFile, int size)
public static String[] loadTXTList(String listFile, int size) throws IOException
//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; } }