1 11 package org.eclipse.jdt.internal.corext.util; 12 13 import java.io.IOException ; 14 import java.io.InputStream ; 15 import java.io.Reader ; 16 17 import org.eclipse.jdt.internal.ui.JavaPlugin; 18 19 public class IOCloser { 20 public static void perform(Reader reader, InputStream stream) { 21 try { 22 rethrows(reader, stream); 23 } catch (IOException e) { 24 JavaPlugin.log(e); 25 } 26 } 27 28 public static void rethrows(Reader reader, InputStream stream) throws IOException { 29 if (reader != null) { 30 reader.close(); 31 return; 32 } 33 if (stream != null) { 34 stream.close(); 35 return; 36 } 37 } 38 } 39 40 | Popular Tags |