package g.g0;

import g.h0.c.l;
import g.i;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: compiled from: ReadWrite.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class g implements g.l0.d<String> {
    public final BufferedReader a;

    /* JADX INFO: compiled from: ReadWrite.kt */
    @i
    public static final class a implements Iterator<String>, g.h0.c.g0.a {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public String f4094b;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public boolean f4095e;

        public a() {
        }

        @Override // java.util.Iterator
        public boolean hasNext() throws IOException {
            if (this.f4094b == null && !this.f4095e) {
                String line = g.this.a.readLine();
                this.f4094b = line;
                if (line == null) {
                    this.f4095e = true;
                }
            }
            return this.f4094b != null;
        }

        @Override // java.util.Iterator
        public String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            String str = this.f4094b;
            this.f4094b = null;
            l.c(str);
            return str;
        }

        @Override // java.util.Iterator
        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    public g(BufferedReader bufferedReader) {
        l.f(bufferedReader, "reader");
        this.a = bufferedReader;
    }

    @Override // g.l0.d
    public Iterator<String> iterator() {
        return new a();
    }
}
