66 lines
2.0 KiB
Java
66 lines
2.0 KiB
Java
|
package com.google.android.gms.common.data;
|
||
|
|
||
|
import android.os.Bundle;
|
||
|
import java.util.Iterator;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class AbstractDataBuffer<T> implements DataBuffer<T> {
|
||
|
protected final DataHolder mDataHolder;
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer, java.io.Closeable, java.lang.AutoCloseable
|
||
|
public final void close() {
|
||
|
release();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer
|
||
|
public abstract T get(int i);
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer
|
||
|
@Deprecated
|
||
|
public boolean isClosed() {
|
||
|
DataHolder dataHolder = this.mDataHolder;
|
||
|
return dataHolder == null || dataHolder.isClosed();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer, java.lang.Iterable
|
||
|
public Iterator<T> iterator() {
|
||
|
return new DataBufferIterator(this);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer, com.google.android.gms.common.api.Releasable
|
||
|
public void release() {
|
||
|
DataHolder dataHolder = this.mDataHolder;
|
||
|
if (dataHolder != null) {
|
||
|
dataHolder.close();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer
|
||
|
public Iterator<T> singleRefIterator() {
|
||
|
return new SingleRefDataBufferIterator(this);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer
|
||
|
public final Bundle getMetadata() {
|
||
|
DataHolder dataHolder = this.mDataHolder;
|
||
|
if (dataHolder == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return dataHolder.getMetadata();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.common.data.DataBuffer
|
||
|
public int getCount() {
|
||
|
DataHolder dataHolder = this.mDataHolder;
|
||
|
if (dataHolder == null) {
|
||
|
return 0;
|
||
|
}
|
||
|
return dataHolder.getCount();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public AbstractDataBuffer(DataHolder dataHolder) {
|
||
|
this.mDataHolder = dataHolder;
|
||
|
}
|
||
|
}
|