blob: 917cf9f15283bee521935056ef351b4397f1aeba [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.corext.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import org.eclipse.jdt.internal.ui.JavaPlugin;
public class IOCloser {
public static void perform(Reader reader, InputStream stream) {
try {
rethrows(reader, stream);
} catch (IOException e) {
JavaPlugin.log(e);
}
}
public static void rethrows(Reader reader, InputStream stream) throws IOException {
if (reader != null) {
reader.close();
return;
}
if (stream != null) {
stream.close();
return;
}
}
private IOCloser() {
}
}