
zone.cogni.libs.core.utils.IOHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cogni-libs Show documentation
Show all versions of cogni-libs Show documentation
Library for Semantic Development
package zone.cogni.libs.core.utils;
import org.apache.commons.io.IOUtils;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class IOHelper {
public static void flushAndClose(X closeFlusher) {
if (closeFlusher == null) return;
try {
closeFlusher.flush();
}
catch (IOException ignore) {
}
try {
closeFlusher.close();
}
catch (IOException ignore) {
}
}
public static void flush(X closeFlusher) {
if (closeFlusher == null) return;
try {
closeFlusher.flush();
}
catch (IOException ignore) {
}
}
public static long copyLarge(InputStream inputStream, OutputStream outputStream) {
try {
return IOUtils.copyLarge(inputStream, outputStream);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy