soul-browser/sources/java/kotlin/io/path/PathsKt__PathReadWriteKt.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* Decompile and recreate Soul Browser v1.4.85 with APK CI builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix CI build: include bundled google.jks and remove PR trigger

The apktool build failed in CI because app/unknown/.../google.jks was
excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files
and commit the missing resource.

Also remove the redundant pull_request workflow trigger.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Change package ID to com.github.kaki87.soulbrowser

Rename the application ID so the rebuilt APK can be installed
alongside the original Soul Browser from Google Play.

- Update AndroidManifest package, permissions, providers, and actions
- Update R class references in smali (com/github/kaki87/soulbrowser/R)
- Update shortcuts.xml targetPackage
- Rename app label to "Soul Rebuild" for easy identification

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install compatibility: remove split APK metadata and bundle native libs

The rebuilt APK still declared requiredSplitTypes and Play Store split
metadata, causing Android to reject standalone installs as incompatible.

- Remove requiredSplitTypes and split-related manifest meta-data
- Merge native libs from all ABI splits with uncompressed storage
- Page-align before signing for extractNativeLibs=false
- Add .so to apktool doNotCompress list

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install failure: use apksigner v2/v3 and bundle arm64 native libs

Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only
produces v1 signatures, causing Android to reject the install.

- Sign with apksigner (v1+v2+v3) instead of jarsigner
- Add arm64-v8a native libraries from universal Soul Browser 1.4.79
- Set extractNativeLibs=true for reliable sideload installs
- Commit stable debug keystore for consistent signatures across builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add committed debug keystore for consistent APK signatures

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix startup crash: use original classes2.dex desugar libraries

Apktool recompiles smali_classes2 into a broken classes2.dex, causing
ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init.

Inject the original classes2.dex (Java 8+ desugar libs) after apktool
build instead of using the recompiled version.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix missing drawable resources from density split APKs

The base APK is an app bundle module; density-specific drawables like
seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild,
causing Resources$NotFoundException at runtime.

- Merge non-9-patch resources from split APKs before apktool build
- Sync public.xml IDs from R smali only when backing files exist
- Add 713 density-specific resource IDs to public.xml

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-10 16:07:14 +02:00

466 lines
28 KiB
Java

package kotlin.io.path;
import com.google.android.gms.ads.RequestConfiguration;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.SinceKotlin;
import kotlin.Unit;
import kotlin.internal.InlineOnly;
import kotlin.io.CloseableKt;
import kotlin.io.FilesKt;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.sequences.Sequence;
import kotlin.sequences.SequencesKt;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000\u008e\u0001\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\r\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u001c\n\u0002\b\u0004\u001a0\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010\b\u001a:\u0010\t\u001a\u00020\n*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\b\b\u0002\u0010\u000b\u001a\u00020\f2\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010\r\u001a0\u0010\u000e\u001a\u00020\u000f*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010\u0010\u001a:\u0010\u0011\u001a\u00020\u0012*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\b\b\u0002\u0010\u000b\u001a\u00020\f2\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010\u0013\u001a\r\u0010\u0014\u001a\u00020\u0015*\u00020\u0002H\u0087\b\u001a.\u0010\u0016\u001a\u00020\u0017*\u00020\u00022\u0006\u0010\u0018\u001a\u00020\u00152\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010\u0019\u001a\u0015\u0010\u001a\u001a\u00020\u0017*\u00020\u00022\u0006\u0010\u0018\u001a\u00020\u0015H\u0087\b\u001a\u0016\u0010\u001b\u001a\u00020\u001c*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u0004H\u0007\u001a7\u0010\u001d\u001a\u00020\u0017*\u00020\u00022\u0006\u0010\u001e\u001a\u00020\u001f2\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0007¢\u0006\u0002\u0010 \u001a\u001e\u0010!\u001a\u00020\u0017*\u00020\u00022\u0006\u0010\u001e\u001a\u00020\u001f2\b\b\u0002\u0010\u0003\u001a\u00020\u0004H\u0007\u001a=\u0010\"\u001a\u00020\u0017*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042!\u0010#\u001a\u001d\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b%\u0012\b\b&\u0012\u0004\b\b('\u0012\u0004\u0012\u00020\u00170$H\u0087\\u0001\u0000\u001a&\u0010(\u001a\u00020)*\u00020\u00022\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010*\u001a&\u0010+\u001a\u00020,*\u00020\u00022\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u0010-\u001a\u001d\u0010.\u001a\b\u0012\u0004\u0012\u00020\u001c0/*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u0004H\u0087\b\u001aL\u00100\u001a\u0002H1\"\u0004\b\u0000\u00101*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0018\u00102\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u001c03\u0012\u0004\u0012\u0002H10$H\u0087\\u0001\u0000\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0002 \u0001¢\u0006\u0002\u00104\u001a>\u00105\u001a\u00020\u0002*\u00020\u00022\f\u00106\u001a\b\u0012\u0004\u0012\u00020\u001f072\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u00108\u001a>\u00105\u001a\u00020\u0002*\u00020\u00022\f\u00106\u001a\b\u0012\u0004\u0012\u00020\u001f032\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006\"\u00020\u0007H\u0087\\u0006\u0002\u00109\u001a%\u0010:\u001a\u00020\u0002*\u00020\u00022\f\u00106\u001a\b\u0012\u0004\u0012\u00020\u001f072\b\b\u0002\u0010\u0003\u001a\u00020\u0004H\u0087\b\u001a%\u0010:\u001a\u00020\u0002*\u00020\u00022\f\u00106\u001a\b\u0012\u0004\u0012\u00020\u001f032\b\b\u0002\u0010\u0003\u001a\u00020\u0004H\u0087\b\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006;"}, d2 = {"reader", "Ljava/io/InputStreamReader;", "Ljava/nio/file/Path;", "charset", "Ljava/nio/charset/Charset;", "options", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "Ljava/nio/file/OpenOption;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/io/InputStreamReader;", "bufferedReader", "Ljava/io/BufferedReader;", "bufferSize", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;I[Ljava/nio/file/OpenOption;)Ljava/io/BufferedReader;", "writer", "Ljava/io/OutputStreamWriter;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStreamWriter;", "bufferedWriter", "Ljava/io/BufferedWriter;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;I[Ljava/nio/file/OpenOption;)Ljava/io/BufferedWriter;", "readBytes", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "writeBytes", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "array", "(Ljava/nio/file/Path;[B[Ljava/nio/file/OpenOption;)V", "appendBytes", "readText", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "writeText", "text", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "(Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)V", "appendText", "forEachLine", "action", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "line", "inputStream", "Ljava/io/InputStream;", "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;", "outputStream", "Ljava/io/OutputStream;", "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;", "readLines", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "useLines", RequestConfiguration.MAX_AD_CONTENT_RATING_T, "block", "Lkotlin/sequences/Sequence;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "writeLines", "lines", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "(Ljava/nio/file/Path;Ljava/lang/Iterable;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "(Ljava/nio/file/Path;Lkotlin/sequences/Sequence;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "appendLines", "kotlin-stdlib-jdk7"}, k = 5, mv = {2, 2, 0}, xi = 49, xs = "kotlin/io/path/PathsKt")
@SourceDebugExtension({"SMAP\nPathReadWrite.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PathReadWrite.kt\nkotlin/io/path/PathsKt__PathReadWriteKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 ReadWrite.kt\nkotlin/io/TextStreamsKt\n+ 4 _Sequences.kt\nkotlin/sequences/SequencesKt___SequencesKt\n*L\n1#1,327:1\n1#2:328\n1#2:330\n57#3:329\n1321#4,2:331\n*S KotlinDebug\n*F\n+ 1 PathReadWrite.kt\nkotlin/io/path/PathsKt__PathReadWriteKt\n*L\n208#1:330\n208#1:329\n208#1:331,2\n*E\n"})
/* loaded from: classes4.dex */
public class PathsKt__PathReadWriteKt {
@SinceKotlin(version = "1.5")
@InlineOnly
private static final void appendBytes(Path path, byte[] array) {
StandardOpenOption standardOpenOption;
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(array, "array");
standardOpenOption = StandardOpenOption.APPEND;
Files.write(path, array, standardOpenOption);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final Path appendLines(Path path, Iterable<? extends CharSequence> lines, Charset charset) {
StandardOpenOption standardOpenOption;
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
standardOpenOption = StandardOpenOption.APPEND;
Path write = Files.write(path, lines, charset, standardOpenOption);
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
public static /* synthetic */ Path appendLines$default(Path path, Iterable lines, Charset charset, int i, Object obj) {
StandardOpenOption standardOpenOption;
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
standardOpenOption = StandardOpenOption.APPEND;
Path write = Files.write(path, lines, charset, standardOpenOption);
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
@SinceKotlin(version = "1.5")
public static final void appendText(@NotNull Path path, @NotNull CharSequence text, @NotNull Charset charset) {
StandardOpenOption standardOpenOption;
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(charset, "charset");
standardOpenOption = StandardOpenOption.APPEND;
writeText(path, text, charset, standardOpenOption);
}
public static /* synthetic */ void appendText$default(Path path, CharSequence charSequence, Charset charset, int i, Object obj) {
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
appendText(path, charSequence, charset);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final BufferedReader bufferedReader(Path path, Charset charset, int i, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new BufferedReader(new InputStreamReader(Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset), i);
}
public static /* synthetic */ BufferedReader bufferedReader$default(Path path, Charset charset, int i, OpenOption[] options, int i2, Object obj) {
if ((i2 & 1) != 0) {
charset = Charsets.UTF_8;
}
if ((i2 & 2) != 0) {
i = 8192;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new BufferedReader(new InputStreamReader(Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset), i);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final BufferedWriter bufferedWriter(Path path, Charset charset, int i, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset), i);
}
public static /* synthetic */ BufferedWriter bufferedWriter$default(Path path, Charset charset, int i, OpenOption[] options, int i2, Object obj) {
if ((i2 & 1) != 0) {
charset = Charsets.UTF_8;
}
if ((i2 & 2) != 0) {
i = 8192;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset), i);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final void forEachLine(Path path, Charset charset, Function1<? super String, Unit> action) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(action, "action");
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
Intrinsics.checkNotNullExpressionValue(newBufferedReader, "newBufferedReader(...)");
try {
Iterator<String> it = TextStreamsKt.lineSequence(newBufferedReader).iterator();
while (it.hasNext()) {
action.invoke(it.next());
}
Unit unit = Unit.INSTANCE;
InlineMarker.finallyStart(1);
CloseableKt.closeFinally(newBufferedReader, null);
InlineMarker.finallyEnd(1);
} finally {
}
}
public static /* synthetic */ void forEachLine$default(Path path, Charset charset, Function1 action, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(action, "action");
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
Intrinsics.checkNotNullExpressionValue(newBufferedReader, "newBufferedReader(...)");
try {
Iterator<String> it = TextStreamsKt.lineSequence(newBufferedReader).iterator();
while (it.hasNext()) {
action.invoke(it.next());
}
Unit unit = Unit.INSTANCE;
InlineMarker.finallyStart(1);
CloseableKt.closeFinally(newBufferedReader, null);
InlineMarker.finallyEnd(1);
} finally {
}
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final InputStream inputStream(Path path, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(options, "options");
InputStream newInputStream = Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(newInputStream, "newInputStream(...)");
return newInputStream;
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final OutputStream outputStream(Path path, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(options, "options");
OutputStream newOutputStream = Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(newOutputStream, "newOutputStream(...)");
return newOutputStream;
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final byte[] readBytes(Path path) {
Intrinsics.checkNotNullParameter(path, "<this>");
byte[] readAllBytes = Files.readAllBytes(path);
Intrinsics.checkNotNullExpressionValue(readAllBytes, "readAllBytes(...)");
return readAllBytes;
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final List<String> readLines(Path path, Charset charset) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
List<String> readAllLines = Files.readAllLines(path, charset);
Intrinsics.checkNotNullExpressionValue(readAllLines, "readAllLines(...)");
return readAllLines;
}
public static /* synthetic */ List readLines$default(Path path, Charset charset, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
List<String> readAllLines = Files.readAllLines(path, charset);
Intrinsics.checkNotNullExpressionValue(readAllLines, "readAllLines(...)");
return readAllLines;
}
@SinceKotlin(version = "1.5")
@NotNull
public static final String readText(@NotNull Path path, @NotNull Charset charset) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
InputStreamReader inputStreamReader = new InputStreamReader(Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(new OpenOption[0], 0)), charset);
try {
String readText = TextStreamsKt.readText(inputStreamReader);
CloseableKt.closeFinally(inputStreamReader, null);
return readText;
} finally {
}
}
public static /* synthetic */ String readText$default(Path path, Charset charset, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
return readText(path, charset);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final InputStreamReader reader(Path path, Charset charset, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new InputStreamReader(Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset);
}
public static /* synthetic */ InputStreamReader reader$default(Path path, Charset charset, OpenOption[] options, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new InputStreamReader(Files.newInputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final <T> T useLines(Path path, Charset charset, Function1<? super Sequence<String>, ? extends T> block) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(block, "block");
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
try {
Intrinsics.checkNotNull(newBufferedReader);
T invoke = block.invoke(TextStreamsKt.lineSequence(newBufferedReader));
InlineMarker.finallyStart(1);
CloseableKt.closeFinally(newBufferedReader, null);
InlineMarker.finallyEnd(1);
return invoke;
} finally {
}
}
public static /* synthetic */ Object useLines$default(Path path, Charset charset, Function1 block, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(block, "block");
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
try {
Intrinsics.checkNotNull(newBufferedReader);
Object invoke = block.invoke(TextStreamsKt.lineSequence(newBufferedReader));
InlineMarker.finallyStart(1);
CloseableKt.closeFinally(newBufferedReader, null);
InlineMarker.finallyEnd(1);
return invoke;
} finally {
}
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final void writeBytes(Path path, byte[] array, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(array, "array");
Intrinsics.checkNotNullParameter(options, "options");
Files.write(path, array, (OpenOption[]) Arrays.copyOf(options, options.length));
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final Path writeLines(Path path, Iterable<? extends CharSequence> lines, Charset charset, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
Path write = Files.write(path, lines, charset, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
public static /* synthetic */ Path writeLines$default(Path path, Iterable lines, Charset charset, OpenOption[] options, int i, Object obj) {
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
Path write = Files.write(path, lines, charset, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
@SinceKotlin(version = "1.5")
public static final void writeText(@NotNull Path path, @NotNull CharSequence text, @NotNull Charset charset, @NotNull OpenOption... options) {
CharBuffer wrap;
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
OutputStream newOutputStream = Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length));
try {
if (text instanceof String) {
Intrinsics.checkNotNull(newOutputStream);
FilesKt.writeTextImpl(newOutputStream, (String) text, charset);
} else {
CharsetEncoder newReplaceEncoder = FilesKt.newReplaceEncoder(charset);
if (text instanceof CharBuffer) {
wrap = ((CharBuffer) text).asReadOnlyBuffer();
} else {
wrap = CharBuffer.wrap(text);
}
int min = Math.min(text.length(), 8192);
Intrinsics.checkNotNull(newReplaceEncoder);
ByteBuffer byteBufferForEncoding = FilesKt.byteBufferForEncoding(min, newReplaceEncoder);
while (wrap.hasRemaining()) {
if (!newReplaceEncoder.encode(wrap, byteBufferForEncoding, true).isError()) {
newOutputStream.write(byteBufferForEncoding.array(), 0, byteBufferForEncoding.position());
byteBufferForEncoding.clear();
} else {
throw new IllegalStateException("Check failed.");
}
}
}
Unit unit = Unit.INSTANCE;
CloseableKt.closeFinally(newOutputStream, null);
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
CloseableKt.closeFinally(newOutputStream, th);
throw th2;
}
}
}
public static /* synthetic */ void writeText$default(Path path, CharSequence charSequence, Charset charset, OpenOption[] openOptionArr, int i, Object obj) {
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
writeText(path, charSequence, charset, openOptionArr);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final OutputStreamWriter writer(Path path, Charset charset, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new OutputStreamWriter(Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset);
}
public static /* synthetic */ OutputStreamWriter writer$default(Path path, Charset charset, OpenOption[] options, int i, Object obj) {
if ((i & 1) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
return new OutputStreamWriter(Files.newOutputStream(path, (OpenOption[]) Arrays.copyOf(options, options.length)), charset);
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final Path appendLines(Path path, Sequence<? extends CharSequence> lines, Charset charset) {
StandardOpenOption standardOpenOption;
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Iterable asIterable = SequencesKt.asIterable(lines);
standardOpenOption = StandardOpenOption.APPEND;
Path write = Files.write(path, asIterable, charset, standardOpenOption);
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
@SinceKotlin(version = "1.5")
@InlineOnly
private static final Path writeLines(Path path, Sequence<? extends CharSequence> lines, Charset charset, OpenOption... options) {
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
Path write = Files.write(path, SequencesKt.asIterable(lines), charset, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
public static /* synthetic */ Path appendLines$default(Path path, Sequence lines, Charset charset, int i, Object obj) {
StandardOpenOption standardOpenOption;
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Iterable asIterable = SequencesKt.asIterable(lines);
standardOpenOption = StandardOpenOption.APPEND;
Path write = Files.write(path, asIterable, charset, standardOpenOption);
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
public static /* synthetic */ Path writeLines$default(Path path, Sequence lines, Charset charset, OpenOption[] options, int i, Object obj) {
if ((i & 2) != 0) {
charset = Charsets.UTF_8;
}
Intrinsics.checkNotNullParameter(path, "<this>");
Intrinsics.checkNotNullParameter(lines, "lines");
Intrinsics.checkNotNullParameter(charset, "charset");
Intrinsics.checkNotNullParameter(options, "options");
Path write = Files.write(path, SequencesKt.asIterable(lines), charset, (OpenOption[]) Arrays.copyOf(options, options.length));
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
return write;
}
}