package o; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.URI; import java.net.URL; import java.nio.charset.Charset; /* renamed from: o.gjp, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15195gjp { static { gjC gjc = new gjC((byte) 0); try { PrintWriter printWriter = new PrintWriter(gjc); try { printWriter.println(); printWriter.close(); gjc.close(); } finally { } } catch (Throwable th) { try { throw th; } catch (Throwable th2) { try { gjc.close(); } catch (Throwable th3) { th.addSuppressed(th3); } throw th2; } } } @Deprecated public static void d(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException unused) { } } } @Deprecated public static String b(InputStream inputStream) throws IOException { return d(inputStream, Charset.defaultCharset()); } public static String d(InputStream inputStream, Charset charset) throws IOException { gjC gjc = new gjC(); try { if (charset == null) { charset = Charset.defaultCharset(); } InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset); char[] cArr = new char[4096]; while (true) { int read = inputStreamReader.read(cArr); if (-1 == read) { String obj = gjc.toString(); gjc.close(); return obj; } gjc.write(cArr, 0, read); } } catch (Throwable th) { try { throw th; } catch (Throwable th2) { try { gjc.close(); } catch (Throwable th3) { th.addSuppressed(th3); } throw th2; } } } @Deprecated public static String a(URI uri) throws IOException { Charset defaultCharset = Charset.defaultCharset(); URL url = uri.toURL(); if (defaultCharset == null) { defaultCharset = Charset.defaultCharset(); } return c(url, defaultCharset); } public static String d(URI uri, Charset charset) throws IOException { URL url = uri.toURL(); if (charset == null) { charset = Charset.defaultCharset(); } return c(url, charset); } private static String c(URL url, Charset charset) throws IOException { InputStream openStream = url.openStream(); try { String d = d(openStream, charset); if (openStream != null) { openStream.close(); } return d; } catch (Throwable th) { try { throw th; } catch (Throwable th2) { if (openStream != null) { try { openStream.close(); } catch (Throwable th3) { th.addSuppressed(th3); } } throw th2; } } } public static void b(byte[] bArr, OutputStream outputStream) throws IOException { if (bArr != null) { outputStream.write(bArr); } } @Deprecated public static void d(InputStream inputStream) { if (inputStream != null) { try { inputStream.close(); } catch (IOException unused) { } } } @Deprecated public static void e(OutputStream outputStream) { if (outputStream != null) { try { outputStream.close(); } catch (IOException unused) { } } } public static int c(InputStream inputStream, OutputStream outputStream) throws IOException { byte[] bArr = new byte[4096]; long j = 0; while (true) { int read = inputStream.read(bArr); if (-1 == read) { break; } outputStream.write(bArr, 0, read); j += read; } if (j > 2147483647L) { return -1; } return (int) j; } }