2929import org .biojava .nbio .core .sequence .template .Compound ;
3030import org .biojava .nbio .core .sequence .template .CompoundSet ;
3131import org .biojava .nbio .core .sequence .template .Sequence ;
32+ import org .slf4j .Logger ;
33+ import org .slf4j .LoggerFactory ;
3234
3335import java .io .*;
3436import java .util .ArrayList ;
3537import java .util .List ;
36- import java .util .logging .Level ;
37- import java .util .logging .Logger ;
3838import java .util .zip .GZIPInputStream ;
3939
4040public class IOUtils {
4141
42+ private static final Logger logger = LoggerFactory .getLogger (IOUtils .class );
43+
4244 private static final int BUFFER = 4096 ;
4345
4446 /**
@@ -54,8 +56,7 @@ public static void close(Closeable c) {
5456 c .close ();
5557 }
5658 } catch (IOException e ) {
57- Logger log = Logger .getLogger (IOUtils .class .getName ());
58- log .log (Level .WARNING , "Cannot close down the given Closeable object" , e );
59+ logger .warn ("Cannot close down the given Closeable object" , e );
5960 }
6061 }
6162
@@ -142,10 +143,9 @@ public static List<String> getList(InputStream is) throws ParserException {
142143 *
143144 * @param file File which is a text file
144145 * @return List of Strings representing the lines of the files
145- * @throws ParserException Can throw this if the file is not a file or we
146- * cannot parse it
146+ * @throws IOException
147147 */
148- public static List <String > getList (File file ) throws ParserException {
148+ public static List <String > getList (File file ) throws IOException {
149149 return getList (openFile (file ));
150150 }
151151
@@ -157,26 +157,22 @@ public static List<String> getList(File file) throws ParserException {
157157 *
158158 * @param file File which may or may not be GZipped
159159 * @return The final stream
160- * @throws ParserException Can throw this if the file is not a file or we
161- * cannot open it for processing
160+ * @throws IOExceptio n
162161 */
163- public static InputStream openFile (File file ) throws ParserException {
162+ public static InputStream openFile (File file ) throws IOException {
164163 final InputStream is ;
165164 if (!file .isFile ()) {
166165 throw new ParserException ("The file " +file +" is not a file." );
167166 }
168167 String name = file .getName ();
169- try {
170- if (name .endsWith (".gz" )) {
171- is = new GZIPInputStream (new FileInputStream (file ));
172- }
173- else {
174- is = new FileInputStream (file );
175- }
168+
169+ if (name .endsWith (".gz" )) {
170+ is = new GZIPInputStream (new FileInputStream (file ));
176171 }
177- catch ( IOException e ) {
178- throw new ParserException ( "Cannot open " + file + " for processing" , e );
172+ else {
173+ is = new FileInputStream ( file );
179174 }
175+
180176 return is ;
181177 }
182178
0 commit comments