package f.y;

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 */
final class k implements f.d0.b<String> {
    private final BufferedReader a;

    /* JADX INFO: compiled from: ReadWrite.kt */
    public static final class a implements Iterator<String>, f.z.d.z.a {

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

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private boolean f3982f;

        a() {
        }

        @Override // java.util.Iterator
        /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
        public String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            String str = this.f3981b;
            this.f3981b = null;
            f.z.d.k.c(str);
            return str;
        }

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

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

    public k(BufferedReader bufferedReader) {
        f.z.d.k.e(bufferedReader, "reader");
        this.a = bufferedReader;
    }

    @Override // f.d0.b
    public Iterator<String> iterator() {
        return new a();
    }
}
