mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
470 lines
28 KiB
Java
470 lines
28 KiB
Java
package kotlin.io.path;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import java.io.BufferedReader;
|
|
import java.io.BufferedWriter;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStreamWriter;
|
|
import java.nio.charset.Charset;
|
|
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.Unit;
|
|
import kotlin.internal.PlatformImplementationsKt;
|
|
import kotlin.io.CloseableKt;
|
|
import kotlin.io.TextStreamsKt;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.InlineMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.sequences.Sequence;
|
|
import kotlin.sequences.SequencesKt;
|
|
import kotlin.text.Charsets;
|
|
|
|
/* compiled from: PathReadWrite.kt */
|
|
@Metadata(d1 = {"\u0000\u0082\u0001\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010\u001c\n\u0002\u0010\r\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0087\b\u001a%\u0010\u0005\u001a\u00020\u0002*\u00020\u00022\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u00072\b\b\u0002\u0010\t\u001a\u00020\nH\u0087\b\u001a%\u0010\u0005\u001a\u00020\u0002*\u00020\u00022\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u000b2\b\b\u0002\u0010\t\u001a\u00020\nH\u0087\b\u001a\u001e\u0010\f\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\r\u001a\u00020\b2\b\b\u0002\u0010\t\u001a\u00020\nH\u0007\u001a:\u0010\u000e\u001a\u00020\u000f*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010\u0015\u001a:\u0010\u0016\u001a\u00020\u0017*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010\u0018\u001a=\u0010\u0019\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2!\u0010\u001a\u001a\u001d\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u001d\u0012\b\b\u001e\u0012\u0004\b\b(\u001f\u0012\u0004\u0012\u00020\u00010\u001bH\u0087\bø\u0001\u0000\u001a&\u0010 \u001a\u00020!*\u00020\u00022\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010\"\u001a&\u0010#\u001a\u00020$*\u00020\u00022\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010%\u001a\r\u0010&\u001a\u00020\u0004*\u00020\u0002H\u0087\b\u001a\u001d\u0010'\u001a\b\u0012\u0004\u0012\u00020\u001c0(*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\nH\u0087\b\u001a\u0016\u0010)\u001a\u00020\u001c*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\nH\u0007\u001a0\u0010*\u001a\u00020+*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010,\u001a?\u0010-\u001a\u0002H.\"\u0004\b\u0000\u0010.*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2\u0018\u0010/\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u001c0\u000b\u0012\u0004\u0012\u0002H.0\u001bH\u0087\bø\u0001\u0000¢\u0006\u0002\u00100\u001a.\u00101\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00042\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u00102\u001a>\u00103\u001a\u00020\u0002*\u00020\u00022\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u00072\b\b\u0002\u0010\t\u001a\u00020\n2\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u00104\u001a>\u00103\u001a\u00020\u0002*\u00020\u00022\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u000b2\b\b\u0002\u0010\t\u001a\u00020\n2\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u00105\u001a7\u00106\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\r\u001a\u00020\b2\b\b\u0002\u0010\t\u001a\u00020\n2\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0007¢\u0006\u0002\u00107\u001a0\u00108\u001a\u000209*\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\n2\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00140\u0013\"\u00020\u0014H\u0087\b¢\u0006\u0002\u0010:\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006;"}, d2 = {"appendBytes", "", "Ljava/nio/file/Path;", "array", "", "appendLines", "lines", "", "", "charset", "Ljava/nio/charset/Charset;", "Lkotlin/sequences/Sequence;", "appendText", "text", "bufferedReader", "Ljava/io/BufferedReader;", "bufferSize", "", "options", "", "Ljava/nio/file/OpenOption;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;I[Ljava/nio/file/OpenOption;)Ljava/io/BufferedReader;", "bufferedWriter", "Ljava/io/BufferedWriter;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;I[Ljava/nio/file/OpenOption;)Ljava/io/BufferedWriter;", "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;", "readBytes", "readLines", "", "readText", "reader", "Ljava/io/InputStreamReader;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/io/InputStreamReader;", "useLines", ExifInterface.GPS_DIRECTION_TRUE, "block", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "writeBytes", "(Ljava/nio/file/Path;[B[Ljava/nio/file/OpenOption;)V", "writeLines", "(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;", "writeText", "(Ljava/nio/file/Path;Ljava/lang/CharSequence;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)V", "writer", "Ljava/io/OutputStreamWriter;", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStreamWriter;", "kotlin-stdlib-jdk7"}, k = 5, mv = {1, 9, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_EDITOR_ABSOLUTEX, xs = "kotlin/io/path/PathsKt")
|
|
/* loaded from: classes3.dex */
|
|
class PathsKt__PathReadWriteKt {
|
|
static /* synthetic */ InputStreamReader reader$default(Path path, Charset charset, OpenOption[] options, int i, Object obj) throws IOException {
|
|
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);
|
|
}
|
|
|
|
private static final InputStreamReader reader(Path path, Charset charset, OpenOption... options) throws IOException {
|
|
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);
|
|
}
|
|
|
|
static /* synthetic */ BufferedReader bufferedReader$default(Path path, Charset charset, int i, OpenOption[] options, int i2, Object obj) throws IOException {
|
|
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);
|
|
}
|
|
|
|
private static final BufferedReader bufferedReader(Path path, Charset charset, int i, OpenOption... options) throws IOException {
|
|
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);
|
|
}
|
|
|
|
static /* synthetic */ OutputStreamWriter writer$default(Path path, Charset charset, OpenOption[] options, int i, Object obj) throws IOException {
|
|
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);
|
|
}
|
|
|
|
private static final OutputStreamWriter writer(Path path, Charset charset, OpenOption... options) throws IOException {
|
|
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);
|
|
}
|
|
|
|
static /* synthetic */ BufferedWriter bufferedWriter$default(Path path, Charset charset, int i, OpenOption[] options, int i2, Object obj) throws IOException {
|
|
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);
|
|
}
|
|
|
|
private static final BufferedWriter bufferedWriter(Path path, Charset charset, int i, OpenOption... options) throws IOException {
|
|
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);
|
|
}
|
|
|
|
private static final byte[] readBytes(Path path) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
byte[] readAllBytes = Files.readAllBytes(path);
|
|
Intrinsics.checkNotNullExpressionValue(readAllBytes, "readAllBytes(...)");
|
|
return readAllBytes;
|
|
}
|
|
|
|
private static final void writeBytes(Path path, byte[] array, OpenOption... options) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(array, "array");
|
|
Intrinsics.checkNotNullParameter(options, "options");
|
|
Files.write(path, array, (OpenOption[]) Arrays.copyOf(options, options.length));
|
|
}
|
|
|
|
private static final void appendBytes(Path path, byte[] array) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(array, "array");
|
|
Files.write(path, array, StandardOpenOption.APPEND);
|
|
}
|
|
|
|
public static /* synthetic */ String readText$default(Path path, Charset charset, int i, Object obj) throws IOException {
|
|
if ((i & 1) != 0) {
|
|
charset = Charsets.UTF_8;
|
|
}
|
|
return PathsKt.readText(path, charset);
|
|
}
|
|
|
|
public static final String readText(Path path, Charset charset) throws IOException {
|
|
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 */ void writeText$default(Path path, CharSequence charSequence, Charset charset, OpenOption[] openOptionArr, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
charset = Charsets.UTF_8;
|
|
}
|
|
PathsKt.writeText(path, charSequence, charset, openOptionArr);
|
|
}
|
|
|
|
public static final void writeText(Path path, CharSequence text, Charset charset, OpenOption... options) throws IOException {
|
|
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));
|
|
Intrinsics.checkNotNullExpressionValue(newOutputStream, "newOutputStream(...)");
|
|
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(newOutputStream, charset);
|
|
try {
|
|
outputStreamWriter.append(text);
|
|
CloseableKt.closeFinally(outputStreamWriter, null);
|
|
} finally {
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void appendText$default(Path path, CharSequence charSequence, Charset charset, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
charset = Charsets.UTF_8;
|
|
}
|
|
PathsKt.appendText(path, charSequence, charset);
|
|
}
|
|
|
|
public static final void appendText(Path path, CharSequence text, Charset charset) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(text, "text");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
OutputStream newOutputStream = Files.newOutputStream(path, StandardOpenOption.APPEND);
|
|
Intrinsics.checkNotNullExpressionValue(newOutputStream, "newOutputStream(...)");
|
|
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(newOutputStream, charset);
|
|
try {
|
|
outputStreamWriter.append(text);
|
|
CloseableKt.closeFinally(outputStreamWriter, null);
|
|
} finally {
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ void forEachLine$default(Path path, Charset charset, Function1 action, int i, Object obj) throws IOException {
|
|
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(...)");
|
|
BufferedReader bufferedReader = newBufferedReader;
|
|
try {
|
|
Iterator<String> it = TextStreamsKt.lineSequence(bufferedReader).iterator();
|
|
while (it.hasNext()) {
|
|
action.invoke(it.next());
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(bufferedReader, null);
|
|
} else {
|
|
bufferedReader.close();
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(bufferedReader, th);
|
|
} else {
|
|
try {
|
|
bufferedReader.close();
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final void forEachLine(Path path, Charset charset, Function1<? super String, Unit> action) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
|
|
Intrinsics.checkNotNullExpressionValue(newBufferedReader, "newBufferedReader(...)");
|
|
BufferedReader bufferedReader = newBufferedReader;
|
|
try {
|
|
Iterator<String> it = TextStreamsKt.lineSequence(bufferedReader).iterator();
|
|
while (it.hasNext()) {
|
|
action.invoke(it.next());
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(bufferedReader, null);
|
|
} else {
|
|
bufferedReader.close();
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(bufferedReader, th);
|
|
} else {
|
|
try {
|
|
bufferedReader.close();
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final InputStream inputStream(Path path, OpenOption... options) throws IOException {
|
|
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;
|
|
}
|
|
|
|
private static final OutputStream outputStream(Path path, OpenOption... options) throws IOException {
|
|
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;
|
|
}
|
|
|
|
static /* synthetic */ List readLines$default(Path path, Charset charset, int i, Object obj) throws IOException {
|
|
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;
|
|
}
|
|
|
|
private static final List<String> readLines(Path path, Charset charset) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
List<String> readAllLines = Files.readAllLines(path, charset);
|
|
Intrinsics.checkNotNullExpressionValue(readAllLines, "readAllLines(...)");
|
|
return readAllLines;
|
|
}
|
|
|
|
static /* synthetic */ Object useLines$default(Path path, Charset charset, Function1 block, int i, Object obj) throws IOException {
|
|
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 {
|
|
BufferedReader bufferedReader = newBufferedReader;
|
|
Intrinsics.checkNotNull(bufferedReader);
|
|
Object invoke = block.invoke(TextStreamsKt.lineSequence(bufferedReader));
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(newBufferedReader, null);
|
|
} else if (newBufferedReader != null) {
|
|
newBufferedReader.close();
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
return invoke;
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(newBufferedReader, th);
|
|
} else if (newBufferedReader != null) {
|
|
try {
|
|
newBufferedReader.close();
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final <T> T useLines(Path path, Charset charset, Function1<? super Sequence<String>, ? extends T> block) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Intrinsics.checkNotNullParameter(block, "block");
|
|
BufferedReader newBufferedReader = Files.newBufferedReader(path, charset);
|
|
try {
|
|
BufferedReader bufferedReader = newBufferedReader;
|
|
Intrinsics.checkNotNull(bufferedReader);
|
|
T invoke = block.invoke(TextStreamsKt.lineSequence(bufferedReader));
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(newBufferedReader, null);
|
|
} else if (newBufferedReader != null) {
|
|
newBufferedReader.close();
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
return invoke;
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
InlineMarker.finallyStart(1);
|
|
if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 1, 0)) {
|
|
CloseableKt.closeFinally(newBufferedReader, th);
|
|
} else if (newBufferedReader != null) {
|
|
try {
|
|
newBufferedReader.close();
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
InlineMarker.finallyEnd(1);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ Path writeLines$default(Path path, Iterable lines, Charset charset, OpenOption[] options, int i, Object obj) throws IOException {
|
|
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;
|
|
}
|
|
|
|
private static final Path writeLines(Path path, Iterable<? extends CharSequence> lines, Charset charset, OpenOption... options) throws IOException {
|
|
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;
|
|
}
|
|
|
|
static /* synthetic */ Path writeLines$default(Path path, Sequence lines, Charset charset, OpenOption[] options, int i, Object obj) throws IOException {
|
|
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;
|
|
}
|
|
|
|
private static final Path writeLines(Path path, Sequence<? extends CharSequence> lines, Charset charset, OpenOption... options) throws IOException {
|
|
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;
|
|
}
|
|
|
|
static /* synthetic */ Path appendLines$default(Path path, Iterable lines, Charset charset, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
charset = Charsets.UTF_8;
|
|
}
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(lines, "lines");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Path write = Files.write(path, lines, charset, StandardOpenOption.APPEND);
|
|
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
|
|
return write;
|
|
}
|
|
|
|
private static final Path appendLines(Path path, Iterable<? extends CharSequence> lines, Charset charset) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(lines, "lines");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Path write = Files.write(path, lines, charset, StandardOpenOption.APPEND);
|
|
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
|
|
return write;
|
|
}
|
|
|
|
static /* synthetic */ Path appendLines$default(Path path, Sequence lines, Charset charset, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
charset = Charsets.UTF_8;
|
|
}
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(lines, "lines");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Path write = Files.write(path, SequencesKt.asIterable(lines), charset, StandardOpenOption.APPEND);
|
|
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
|
|
return write;
|
|
}
|
|
|
|
private static final Path appendLines(Path path, Sequence<? extends CharSequence> lines, Charset charset) throws IOException {
|
|
Intrinsics.checkNotNullParameter(path, "<this>");
|
|
Intrinsics.checkNotNullParameter(lines, "lines");
|
|
Intrinsics.checkNotNullParameter(charset, "charset");
|
|
Path write = Files.write(path, SequencesKt.asIterable(lines), charset, StandardOpenOption.APPEND);
|
|
Intrinsics.checkNotNullExpressionValue(write, "write(...)");
|
|
return write;
|
|
}
|
|
}
|