alexandroid/decompiled/jadx/sources/com/google/common/io/MultiReader.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

83 lines
2.3 KiB
Java

package com.google.common.io;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.J2ktIncompatible;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.Reader;
import java.util.Iterator;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@J2ktIncompatible
@GwtIncompatible
/* loaded from: classes8.dex */
class MultiReader extends Reader {
private Reader current;
/* renamed from: it, reason: collision with root package name */
private final Iterator<? extends CharSource> f1139it;
public MultiReader(Iterator<? extends CharSource> it2) throws IOException {
this.f1139it = it2;
advance();
}
private void advance() throws IOException {
close();
if (this.f1139it.hasNext()) {
this.current = this.f1139it.next().openStream();
}
}
@Override // java.io.Reader, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
Reader reader = this.current;
if (reader != null) {
try {
reader.close();
} finally {
this.current = null;
}
}
}
@Override // java.io.Reader
public int read(char[] cArr, int i, int i2) throws IOException {
Preconditions.checkNotNull(cArr);
Reader reader = this.current;
if (reader == null) {
return -1;
}
int read = reader.read(cArr, i, i2);
if (read != -1) {
return read;
}
advance();
return read(cArr, i, i2);
}
@Override // java.io.Reader
public boolean ready() throws IOException {
Reader reader = this.current;
return reader != null && reader.ready();
}
@Override // java.io.Reader
public long skip(long j) throws IOException {
Preconditions.checkArgument(j >= 0, "n is negative");
if (j > 0) {
while (true) {
Reader reader = this.current;
if (reader == null) {
break;
}
long skip = reader.skip(j);
if (skip > 0) {
return skip;
}
advance();
}
}
return 0L;
}
}