/*
 * Copyright 2014 Kevin Quan (kevin.quan@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.kevinquan.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.util.zip.ZipFile;

/**
 * Helpers for I/O
 * @author Kevin Quan (kevin.quan@gmail.com)
 *
 */
public class IOUtils {

	@SuppressWarnings("unused")
	private static final String TAG = IOUtils.class.getSimpleName();

	/**
	 * Close a zip file if necessary. Exceptions are squelched
	 * @param file The file to close
	 */
	public static void safeClose(ZipFile file) {
		if (file == null) {
			return;
		}
		try {
			file.close();
		} catch (IOException ioe) {
			// Squelched.
		}
	}
	
	/**
	 * Close an inputstream if necessary.  Exceptions are squelched
	 * @param stream The stream to close
	 */
	public static void safeClose(InputStream stream) {
		if (stream == null) {
			return;
		}
		try {
			stream.close();
		} catch (IOException ioe) {
			// Squelched.
		}
	}
	
	   /**
     * Close a writer if necessary.  Exceptions are squelched
     * @param writer The writer to close
     */
    public static void safeClose(Writer writer) {
        if (writer == null) {
            return;
        }
        try {
            writer.close();
        } catch (IOException ioe) {
            // Squelched.
        }
    }
}

@@ -697,16 +697,39 @@
 Stream;%0A
+import java.io.Reader;%0A
 import j
@@ -1529,15 +1529,12 @@
 %0A%09%0A%09
-   
 /**%0A
+
     
@@ -1764,16 +1764,16 @@
   try %7B%0A
-
         
@@ -1870,10 +1870,363 @@
 %7D%0A    %7D%0A
+    %0A    /**%0A     * Close a reader if necessary. Exceptions are squelched%0A     * @param reader The reader to close%0A     */%0A    public static void safeClose(Reader reader) %7B%0A        if (reader == null) %7B%0A            return;%0A        %7D%0A        try %7B%0A            reader.close();%0A        %7D catch (IOException ioe) %7B%0A            // Squelched.%0A        %7D%0A    %7D%0A
 %7D%0A

Add util for Readers